Skip to content

shadcn.io is an independent project built on shadcn/ui

Components

Free

Empty for Ark UI

An empty state for React on Ark UI: an icon, a title, a line of help and a next step, for a list, a table or a search that came back with nothing.

On this page9 sections

An empty state takes the place of a list, a table or a page that loaded with nothing in it. It centers an icon, a short title, a line on why it's empty and the action that fills it, such as Create project, so the blank space tells people what to do next.

While the data is still loading, show a Skeleton instead. When loading failed, an Alert with a way to retry is the clearer message.

Preview width

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.

Anatomy

Empty anatomy: root, header, media, title, description, content

Usage

import { FolderCodeIcon } from "lucide-react";
import { Button } from "@/components/ui/button";
import {
  Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia,
  EmptyTitle,
} from "@/components/ui/empty";

EmptyHeader holds the icon, the title and the description, and EmptyContent after it holds what people can do next. Every part is optional.

<Empty>
  <EmptyHeader>
    <EmptyMedia variant="icon">
      <FolderCodeIcon aria-hidden="true" />
    </EmptyMedia>
    <EmptyTitle>No Projects Yet</EmptyTitle>
    <EmptyDescription>
      You haven&apos;t created any projects yet.
    </EmptyDescription>
  </EmptyHeader>
  <EmptyContent>
    <Button>Create Project</Button>
  </EmptyContent>
</Empty>

Accessibility

Empty and its parts are plain divs with no role, so a screen reader reads the title, the description and the actions in order, like any other text. EmptyTitle isn't a heading. When the empty state stands in for a section's content, put a heading element of the right level inside it, and Tailwind's base styles let it keep the title's look. Mark the icon in EmptyMedia aria-hidden, as the demos do, since the title says the same. An empty state that replaces results after a search isn't announced, so render it inside an element with role="status" that is already on the page.

Demos

Outline

An empty cloud storage area, with a cloud icon, one line about uploading and an Upload files button, inside a dashed outline. The outline comes from the border and border-dashed classes on Empty. Use it for a slot people are meant to fill, such as a drop zone or an empty column on a board, where a frame shows where things will go.

Preview width

Background

No notifications, with a bell icon, a line saying you're all caught up and a Refresh button, on a faint muted fill. The classes on Empty set the fill and a full height, so the message covers the whole panel it sits in. Use a fill when the empty state takes over a pane, such as a notifications drawer, and keep it faint, since nothing is wrong.

Preview width

Avatar

A user who is offline, shown by their photo in grayscale, with a Leave message button. EmptyMedia keeps its default variant, a bare slot, because the icon variant's small tile is sized for an icon, not a 48-pixel avatar. Use a face when the empty state is about one person, such as a chat with nobody on the other end.

Preview width

Avatar group

No team members yet, with three overlapping grayscale avatars and an Invite members button. The avatars sit in a row with negative spacing and a ring in the page's background color, inside EmptyMedia in its default variant. Use faces when what's missing is other people, such as a team or a shared project nobody has joined.

Preview width

Input group

A 404 page with no icon, a search Input Group labeled Search pages through aria-label, and a Contact support link in a second EmptyDescription under it. Offer a search when the next step is to look for something else rather than create what's missing. Keep the label when you restyle it, since the placeholder is gone once people type.

Preview width

No filter results

A list whose filters matched nothing, with a filter icon, the title No items match your filters, a line suggesting looser filters and an outline Clear Filters button. The title says what happened and the button undoes it, rather than offering to create something. The button does nothing here, so wire it to reset your own filter state.

Preview width

Card

A dashboard's Projects card whose body is an empty state: a folder icon, No projects yet, a Create project link and an Import project button in a row, and a muted Learn more link. Empty sits in CardContent with no classes of its own, so the card frames it. Use it for a dashboard tile with nothing to show yet, with the docs link quieter than both actions.

Preview width

RTL

The projects message from the top of the page in Arabic, with dir set to rtl on Empty. The two buttons swap sides because the row follows the direction, and the arrow on the Learn more link turns to point up and left through a rotate class for right-to-left. Use it to check a translated empty state, where the title can wrap in new places.

Preview width

FAQ

When should I use an Empty state instead of a Skeleton or an Alert?

Show a Skeleton while the data is on its way, and switch to an Empty state only once the request has finished with nothing in it. An empty state during the load tells people the list is empty for good, and they may start creating what's already there.

When the request failed, the list isn't empty, it's unknown. Say what went wrong in an Alert with a way to retry, or reuse the empty layout with that message and a Try again button in EmptyContent.

How do I build an Empty state in React?

Start with Empty, the centered frame. Inside it, EmptyHeader holds the message: EmptyMedia for an icon or an image, EmptyTitle for the short line and EmptyDescription for the sentence under it. EmptyContent comes after the header and holds what people can do, such as a button, a link or a search field.

Every part is optional and none of them has behavior, so leave out what you don't need, as the Input group demo leaves out the media. The header and the content are both capped at a narrow width, which keeps centered text easy to read.

How do I show an icon or an image in an Empty state?

Put it in EmptyMedia. Set variant to icon for a single icon, which puts it on a small square tile and sizes it to fit, unless the icon has a size class of its own. Leave variant at default for anything else, an avatar, a group of them or an illustration, and size it yourself, as the Avatar demo does.

Mark a decorative icon aria-hidden, since the title already says what it shows. An image that carries meaning, such as a person's photo, keeps its alt text.

How do I add a border or a background to an Empty state?

Add classes to Empty, which merges them with its own. The Outline demo adds border and border-dashed for a frame around an area to fill, and the Background demo adds a faint muted fill and h-full, so the fill covers its panel.

The padding, the gap and the corner radius come from your installed style, and a class on Empty overrides them the same way. Keep strong colors off it, since an empty list isn't an error.

How do I make an Empty state fill its container?

Put it in a flex column with a set height. Empty has flex-1, so in a flex parent it grows into the free space and centers its content there. In a block parent it is only as tall as its content, so give it a height, h-full when the parent has one, or a minimum height such as min-h-80 for a list area.

It already spans the full width of its parent, while the header and the actions stay narrow in the middle.

How do I show an Empty state when a search or filter has no results?

Render it in place of the results when the finished query returns nothing, and let the title say what happened, No invoices match these filters, rather than a generic Nothing here. Put the way out in EmptyContent: a Clear filters button that resets them, as in the No filter results demo, or a search field to try other words.

Keep this apart from a list that has never had anything in it, which should offer to create the first item instead. For screen readers, show the message inside an element with role="status" that is on the page before the search runs, so it is announced.

How do I show an Empty state inside a table?

Render one row with a single cell that spans every column, and put Empty inside that cell. The table keeps its header, so people still see what the columns would hold, and the message sits centered under them across the full width.

In a short table, leave out the media and keep a title, one line and a button such as Add entry. A large icon in a table body pushes the action down where it's easy to miss.

How do I make an Empty state accessible?

Most of it already is: the parts are plain divs, so a screen reader reads the title, the description and the actions in order, and the buttons and links in EmptyContent sit in the tab order like any others. Two things are left to you.

EmptyTitle isn't a heading, so put a heading element inside it when the empty state stands in for a section, and Tailwind's base styles keep the title's look. When the state replaces results after a search or a filter, nothing is announced, so render it inside a role="status" element that is already on the page.

API Reference

Empty

<div> data-slot="empty"

PropType
className?string

Merged with the part's classes.

EmptyHeader

<div> data-slot="empty-header"

PropType
className?string

Merged with the part's classes.

EmptyMedia

<div> data-slot="empty-icon"

PropType
variant?"default" | "icon"

The visual style.

Type
"default" | "icon"
Default
"default"
className?string

Merged with the part's classes.

AttributeType
data-variant?string

Mirrors variant.

EmptyTitle

<div> data-slot="empty-title"

PropType
className?string

Merged with the part's classes.

EmptyDescription

<div> data-slot="empty-description"

PropType
className?string

Merged with the part's classes.

EmptyContent

<div> data-slot="empty-content"

PropType
className?string

Merged with the part's classes.