Base · Feedback
Empty
A placeholder for an area that has no content yet, explaining why and what to do next.
Props
import { Button } from "@/components/ui/button"
import {
Empty,
EmptyContent,
EmptyDescription,
EmptyHeader,
EmptyMedia,
EmptyTitle,
} from "@/components/ui/empty"
import { PackageIcon, PlusIcon } from "lucide-react"
<Empty className="border">
<EmptyHeader>
<EmptyMedia>
<PackageIcon aria-hidden="true" />
</EmptyMedia>
<EmptyTitle>No shipments yet</EmptyTitle>
<EmptyDescription>Shipments you create or import will appear here.</EmptyDescription>
</EmptyHeader>
<EmptyContent>
<Button>
<PlusIcon data-icon="inline-start" />
Create shipment
</Button>
</EmptyContent>
</Empty>Overview
An empty state fills a list, table or page that has nothing to show. It says what belongs there, why it is empty, and gives the user one clear way forward.
When to use
- When a list or table has no items yet: explain what will appear and offer the action that creates the first one.
- When a search or filter returns nothing: say so and offer to clear the filters.
- When a feature has not been set up, or the user lacks access to its content.
When not to use
- While data is still loading: use Skeletons or a Spinner.
- When loading failed: use an Alert with a way to retry. An error is not an empty state.
- For a single empty cell or field: show a dash or short muted text instead.
Anatomy
Container
Centers its content and fills the available space. Add a border class to get a dashed outline.
Media (optional)
An icon or illustration. The icon variant places the icon in a small muted square.
Title
States what is missing, such as “No shipments yet”.
Description
One or two sentences on why it is empty and what to do.
Content (optional)
The action: usually one Button, sometimes with a secondary link.
Props
The contract every language implements. Names follow each language’s conventions (camelCase in React, snake_case in Rust).
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | "default" | "icon" | default | Set on EmptyMedia. `icon` frames a small icon in a muted square; `default` shows the media as is, for illustrations or avatars. |
| title | string | No shipments yet | Passed as children of EmptyTitle. |
| description | string | Shipments you create or import will appear here. | Passed as children of EmptyDescription. |
| actionLabel | string | Create shipment | Label of the button in EmptyContent. |
States
- First use
- Nothing has been created. Lead with the creating action.
- No results
- A search or filter matched nothing. Offer to clear it rather than create.
Accessibility
| Keys | Action |
|---|---|
| Tab | Moves focus to the action inside the empty state. |
- The title is a div, not a heading. Render a heading element inside it when the empty state is the main content of the page.
- Icons and illustrations are decorative; hide them with aria-hidden.
- When results become empty after a filter change, announce it with a polite live region.
Design tokens
Change any of these in Foundations and this component follows, in every language.
Platform notes
- HTML / JS
- Planned
- Not built in HTML / JS yet.
- React
- Stable
- Matches the contract with no platform differences.
- React Native
- Draft
- A centred column that grows to fill a FlatList's ListEmptyComponent. The dashed border is zero width until you add borderWidth.
- Swift (SwiftUI)
- Planned
- Not built in Swift yet.
- Godot
- Planned
- Not built in Godot yet.
- Vue
- Draft
- Usage snippet only; same props and behavior as the React component.
- Svelte
- Draft
- Usage snippet only; same props and behavior as the React component.
- Solid
- Draft
- Usage snippet only; same props and behavior as the React component.