How it works
Sits where the content would be, as a centred column: picture, title, description, buttons. The built-in picture is drawn in HTML and CSS: a raised front tile with a line icon, two blank tiles fanned out behind it over a faint dot grid, and one small coloured badge that carries the meaning (accent +, accent ×, danger !, warning no-entry). Everything reads surface and text tokens, so light and dark both work; size sm is the same drawing at 0.75. Buttons: an ink primary, a filled grey secondary and a text button, 40px (32px in sm). The component has no state and no role of its own.
Use it for
- First visit, when the whole page is empty: the title states the situation and the button gives the next step.
- No results after a filter or search: use no-results and offer "Clear filters".
- Data failed to load: use error and offer "Reload".
- No permission for a page or block: use no-access and say who to ask.
- An empty table or card: use size="sm" in place of the table body.
Look elsewhere when
- Data is still loading: use a skeleton instead of flashing an empty state.
- A single cell or field has no value: write "—".
- An action just failed (save, payment): report it in place or with a toast.
- A dropdown has no options: one line of text is enough, no illustration.
Usage
import { EmptyState } from './EmptyState.jsx'
// First visit, the whole page is empty: tell people what to do next
<EmptyState
title="No products yet"
description="Add your first product so shoppers can find and order it."
action={
<button type="button" className="ds-empty__btn" onClick={goCreate}>
Add product
</button>
}
/>
// No results after filtering: offer "Clear filters" and announce it
<EmptyState
kind="no-results"
role="status"
title="No products match"
description="Try raising the price limit or another roast."
action={
<button type="button" className="ds-empty__btn ds-empty__btn--secondary" onClick={clearFilters}>
Clear filters
</button>
}
/>
// Inside a table: small size
<td colSpan={5}>
<EmptyState size="sm" kind="error" title="Orders didn't load" />
</td>Props
| Prop | Type | Default | What it does |
|---|---|---|---|
kind | 'no-data' | 'no-results' | 'error' | 'no-access' | 'no-data' | Which built-in picture to use: no-data, no-results, error or no-access. |
illustration | ReactNode | — | Your own illustration (SVG or <img>, fitted into a 96px / 72px box). Pass null for none. |
title | ReactNode | — | One sentence stating the current situation. Required. |
description | ReactNode | — | Why it is empty and what to do next. At most 320px wide, then wraps. |
action | ReactNode | — | Slot for the primary action, such as <button className="ds-empty__btn"> (an ink button). |
secondaryAction | ReactNode | — | Slot for a secondary action, placed after the primary. Use ds-empty__btn--text or --secondary. |
size | 'sm' | 'md' | 'md' | md for pages and large blocks; sm for tables and cards (picture at 0.75, 32px buttons). |
titleAs | 'p' | 'h2' | 'h3' | 'h4' | 'p' | Tag for the title. For a full-page empty state pick the heading level that fits the page. |
...rest | HTMLAttributes<HTMLDivElement> | — | Passed to the root element. Give role="status" to an empty state that appears after filtering. |
Accessibility
- The illustration is decorative and hidden from screen readers; the title, description and buttons are read in that order.
- No role by default: pass role="status" for an empty state that appears after filtering, searching or reloading.
- Put real <button> or <a> elements in the action slots; busy buttons use aria-busy and keep their width.
- On touch screens the tap area of the buttons grows to 44px.
- The title is a <p> by default; use titleAs for a heading on full-page empty states.
- The entry and hover motion move only transform and opacity and are off under reduced motion.
Motion
On mount, once: the blank tiles fan out (760ms, reveal curve), the front tile rises 10px (640ms), the badge pops with a slight overshoot (480ms, 280ms delay), then title, description and buttons rise 6px in turn (120 / 170 / 220ms delays). Hovering the empty state fans the blank tiles 4° wider (360ms). Buttons scale to 0.98 on press (100ms); the busy spinner turns once per 0.8s. With reduced motion there is no entry or hover movement and the spinner turns once per 1.6s.
Add it to your project
Copy the prompt into Codex or Claude Code. The agent reads the published source, shows you what it will write and adds the component next to your own.
EmptyState.jsxempty-state.csstokens.cssREADME.md
Both files install together. The stylesheet reads the design tokens in tokens.css and carries fallbacks, so it also works alone.



