Empty
The state a list, table or page shows when there is nothing in it yet, with the next action.
When to use
- A list, table or page has nothing in it yet, and there is a next step.
- A search or a filter returned no results.
When not to use
- Content is still loading: use Skeleton.
- Something failed: use Alert, and say what to fix.
Install
npx shadcn@latest add @clinia/emptyNo sources yet
Connect a source to start indexing records into this workspace.
No sources match “lab”
Try another search term, or clear the filters to see every source.
Anatomy
No sources yet
Connect a source to start indexing records.
- 1Container
data-slot="empty"p-12 · border-dashed - 2Media
data-slot="empty-icon"variant=icon · bg-muted - 3Title, what's missing
data-slot="empty-title"text-lg · font-medium - 4Description, what to do
data-slot="empty-description"text-sm · text-muted-foreground - 5Action
data-slot="empty-content"one main Button
Clinia rules
- The title says what's missing:
No sources yet. The description says what to do about it. - Give one main action, the one that fills the state:
Connect a source. Emptysetsborder-dashedbut no border width. Addborder border-borderwhen the state needs an outline.EmptyMedia variant="icon"puts the icon on abg-mutedtile.
Do and don't
No sources yet
Connect a source to index records.
No data
States
title · heading
No sources yet
Connect a source to start indexing records into this workspace.
Toggle the site theme to review both themes.
Accessibility
Your responsibility
EmptyTitlerenders adiv. When the empty state stands in for a page section, make it a heading at the right level:render={<h2 />}.- Make the action a real Button or link, so it's reachable with Tab.
How to test
- Press Tab: focus reaches the action.
- With a screen reader, the title and the description are read in order, then the action.
API
EmptyTitle
| Prop | Values | Default | Description |
|---|---|---|---|
| render | ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, {}> | – | The element to render, such as |
EmptyMedia
| Prop | Values | Default | Description |
|---|---|---|---|
| variant | defaulticon | default |
|
All other props come from the native div element.