Empty & Error States
One shape for "there is nothing here" and "we couldn't load this", so both read the same across pages, cards and table bodies.
Reach for EmptyState when a list is genuinely empty, and ErrorState when a request failed. They are separate components on purpose: telling someone they have no items when the fetch merely broke is the one answer that is actually wrong, and it is the easiest mistake to make when both states share a branch.
Resolve the error case before the empty case:
if (query.isError) return <ErrorState onRetry={() => void query.refetch()} />;
if (query.isPending) return <ListSkeleton />;
if (items.length === 0) return <EmptyState title="No items yet" />;Basic
No reports yet
Reports appear here once you schedule your first one.
With an action
Only offer one when creating the missing thing is actually possible here. A "New report" button on a "nothing shared with you" state is a dead end — nothing the user does on this screen changes that list.
No reports yet
Reports appear here once you schedule your first one.
Without a title
title is optional. On a subdued surface — one tab of a card, a small section — a headline plus a sentence usually says the same thing twice, and the sentence alone carries it. Keep the headline for page-level states, where the empty view has to stand on its own.
ErrorState is the exception: it always renders a headline, falling back to its own copy, because a failure the reader has to infer from one line of tertiary text is a failure they will read as an empty list.
Citations from answer engines appear here after the next prompt run.
Sizes
page stands in for a whole list view, section for a card or one tab of a list, and inline for small containers where reserving height would look wrong.
No prompts tracked yet
size="page"
No prompts tracked yet
size="section"
No prompts tracked yet
size="inline"
Error state
Point onRetry at the query that failed rather than a page reload — reloading discards everything else that loaded fine.
ErrorState renders with role="alert", so screen readers announce the failure. Pass role to override it.
We couldn't load this
Something went wrong loading your tracked prompts.
Without a retry
Omit onRetry when there is nothing useful to retry — a crashed section, or a failure the user can only resolve by navigating away.
Visibility trends are unavailable
Refresh the page to try again.
Installation
pnpm dlx shadcn@latest add @narakui/empty-stateAdd "@narakui": "https://ui.narakcode.dev/r/{name}.json" to components.json, or install directly from https://ui.narakcode.dev/r/empty-state.json.
EmptyState Properties
| Prop | Type | Default | Description |
|---|---|---|---|
icon | IconValue | — | Icon name, descriptor, or node above the title. Size it to match the surface |
title | ReactNode | — | Headline for the state |
description | ReactNode | — | One sentence on what would appear here, or what to do about it |
action | ReactNode | — | Primary action, such as creating the missing thing |
size | 'page' | 'section' | 'inline' | 'section' | Vertical room the state takes |
className | string | — | Additional classes for the container |
ErrorState Properties
| Prop | Type | Default | Description |
|---|---|---|---|
onRetry | () => void | — | Retries the failed work. Omit to render the message without a button |
retryLabel | ReactNode | 'Try again' | Label for the retry button |
title | ReactNode | "We couldn't load this" | Headline for the failure |
icon | IconValue | 'warning' | Icon above the title |
description | ReactNode | — | One sentence on what failed |
size | 'page' | 'section' | 'inline' | 'section' | Vertical room the state takes |
className | string | — | Additional classes for the container |