Empty state
What a data component shows when it is working and has found nothing — a title, a reason, and the thing to do about it.
{/* Generated by scripts/build-component-docs.mjs — do not edit. The source is the component folder: guidance.json, the doc block and the props. Change those. */}
What a data component shows when it is working and has found nothing — a title, a reason, and the thing to do about it.
Import
import { EmptyState } from "@ir/ui";Variants
| Axis | Options | Default |
|---|---|---|
size | md · sm | md |
Props
| Prop | Type | Required | What it does |
|---|---|---|---|
title | React.ReactNode | yes | One line, sentence case, no full stop. |
description | React.ReactNode | yes | Why it is empty and what would fill it. Required on purpose — see the component notes. |
illustration | IllustrationName | The 160 drawing. md only; ignored at sm. | |
icon | React.ReactNode | A glyph instead of a drawing — the usual choice at sm. | |
action | React.ReactNode | What to do about it: one Button, or a ButtonGroup for two. |
Do and don't
Name what is missing and what would bring it back — "No alerts in the last 24 hours. Widen the time range to see older activity."
Don't — Ship "No data."
The whole component exists for this. A title with no reason leaves the reader unable to tell a working empty list from a broken one, which is why description is a required prop rather than an optional one.
Empty asks for a change to the question; first use asks for setup and says what will appear once it is done.
Don't — Use one state for both, so a product nobody has set up yet says "No endpoints match your filters".
They need different actions. Offering "Clear filters" to someone who has never connected a source sends them looking for a filter that is not there — and implies they broke something.
Draw what loaded and put an Alert above it naming what did not.
Don't — Replace the chart with an empty state because one of four sources failed.
Partial means there IS something to show. A centred block in place of the data hides the part that worked, which is the "never silently drop a source" rule inverted — now the working sources are the ones dropped.
Show a Skeleton, and the empty state only once the answer is known to be nothing.
Don't — Show an empty state while the request is still in flight.
An empty state during a load is a wrong answer shown confidently. The guidance prefers a skeleton to a spinner because the layout is already known.
Use size="sm" there — an icon, tighter padding, no drawing. md is for a page, a table body or a panel.
Don't — Put the 160 drawing inside a chart frame or a popover.
A drawing larger than the space it is explaining reads as a page that failed rather than a widget with nothing in it. illustration is ignored at sm so this cannot be got wrong by accident.
Accessibility
- A plain block of text in reading order — no role, so it does not announce itself on mount.
- It is NOT a live region. A component that swaps a Skeleton for an empty state should announce that itself, where it knows the request finished; a role="status" here would also fire on first paint.
- The illustration is drawn with
label={null}andinteractive={false}: the title beside it says the same thing, and nothing in an empty state should answer the pointer. iconis aria-hidden. Everything it suggests is in the title and description.
Where it is drawn
Not drawn in Figma. Built in code first, from docs/content/empty-and-loading-states.md. Error page in the file is the nearest component and a different job — 404 and 500 are the app having failed.