Empty

new

An empty state with media, a title, a description and actions, sized by one prop and drawn on whatever holds it.

Demo

No projects yet

Create a project to start tracking work, or import one from another tool.

Learn more

Open Props in the corner of the example to try size.

sm, md and lg in cards of one size, so only the empty state changes.

Installation

Usage

<script setup lang="ts">
import { FolderOpen } from '@lucide/vue'

import { Button } from '@/components/ui/button'
import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from '@/components/ui/empty'
</script>

<template>
  <Empty>
    <EmptyHeader>
      <EmptyMedia><FolderOpen /></EmptyMedia>
      <EmptyTitle>No projects yet</EmptyTitle>
      <EmptyDescription>Create a project to start tracking work.</EmptyDescription>
    </EmptyHeader>
    <EmptyContent>
      <Button>Create project</Button>
    </EmptyContent>
  </Empty>
</template>

Empty is a centred column. EmptyHeader groups the media, the title and the description and keeps them no wider than 24rem; EmptyContent does the same for the actions below. Anything else, such as a link, goes straight into Empty.

It draws no border and no background. The surface comes from what holds it: a Card, the empty slot of a DataTable, or the page itself. That keeps one empty state right in every place it appears, without variants that try to guess the container.

size runs from xs to xl and sets the padding and the gaps. A bare icon in EmptyMedia follows it too, from 24px to 56px, through --empty-icon on the root. The title and description keep text-title-md and text-body-md, so a text-* class of your own on them wins. md by default.

EmptyTitle is an h3. Set as to the level that fits the page, h2 on an empty page and h4 inside a card that already has a heading.

Examples

In a card

The card draws the border and the radius; the empty state only fills it.

In a card

Inbox zero

New messages will show up here.

In a table

A DataTable with no rows renders its empty slot in a centred cell that already pads and mutes its content, so this one drops its own padding and restores the text colour with class.

In a table
InvoiceCustomerAmount

No invoices yet

The first invoice you send will appear here.

Avatars

EmptyMedia takes anything, here an AvatarGroup. Only a bare svg is sized by the root; other content keeps its own size.

Avatars
ALMCGH

No team members

Invite your team to work on this project together.

An empty state without media, with an InputGroup in the content and a second description under it.

Search

404, page not found

The page you are looking for does not exist. Try searching for what you need.

/

Need help? Contact support

API Reference

Every part accepts class, merged over its base classes.

Data attributes

data-slotAttributesDescription
emptydata-sizeThe root. The parts read data-size through the group/empty class.
empty-header—The media, title and description.
empty-media—The icon, avatar or image.
empty-title—The heading, an h3 unless as says otherwise.
empty-description—The muted paragraph.
empty-content—The actions.

Changelog

  1. registry 0.22.0

    b0d5b8b — icon-size-* on EmptyMedia now sizes its bare icon: the part's own icon rule sits in :where(), so it no longer ties with the class and wins by source order.

  2. registry 0.21.0

    a45ad9f — New ErrorState: Empty's anatomy for a failure. Six parts (ErrorState, ErrorStateHeader, ErrorStateMedia, ErrorStateTitle, ErrorStateDescription, ErrorStateActions) over the Empty parts, role="alert" on the root unless you pass another role, a circled exclamation mark in the destructive colour as the default media, and size from xs to xl as on Empty.

    e5495ef — size works the same way everywhere. Every component exports its size type (AlertSize, BadgeSize, CardSize, CheckboxSize, RadioSize, SwitchSize, EmptySize, InputFloatingSize, ItemSize, ListboxSize, SeparatorSize, SliderSize, StepperSize, TabsSize, TextareaSize, TimelineSize) and the props take it without null; Button-based parts take ButtonSize, Input TextControlSize, SelectTrigger SelectSize and Tree TreeSize. ToggleGroup and ToolbarToggleGroup carry data-size on the group as well. Table's row heights moved into tableSize, so a class on DataTable's ui.table overrides --table-row-h at every size, not only at md.

  3. registry 0.19.0

    adf96cd — Parts no longer style themselves from their root's size through group-data-[size=…] variants, which beat any plain class of yours. size is the density of the root, and a class on a part wins:

    - Card, Empty, Alert and Stepper: CardTitle, CardDescription, EmptyTitle, EmptyDescription, AlertTitle, AlertDescription, StepperTitle and StepperDescription keep one text size at every root size (title-md/body-md, title-sm/body-md for Alert, title-sm/body-sm for Stepper). Empty's icon and gaps and Stepper's indicator number still follow the size, through --empty-icon, --empty-header-gap, --empty-content-gap and --stepper-text on the root. - Menu and DrawerMenu labels, Menubar triggers and the Calendar heading, weekday cells and week numbers keep scaling with the size, through --menu-label, --menubar-text, --calendar-heading and --calendar-label (each with a -leading twin) set by the root. - AlertDialog size="sm" centres its text through the content, so text-start on AlertDialogHeader wins; the footer keeps its two-column grid.

  4. registry 0.7.0

    5af8a9b — Empty: Empty, EmptyHeader, EmptyMedia, EmptyTitle, EmptyDescription and EmptyContent for empty states. One size from xs to xl scales the spacing, the icon and the type; the layout draws no surface of its own, so it sits in a card, a table or a page.