Empty State
- Stable
- WCAG 2.2 evidence
- RTL
Explains why a list, table or page has no content and what to do next. The title is a heading and the description is text, so
the message never depends on the picture (WCAG 1.1.1, 1.3.1); the icon tile and illustration are decorative.
Presentational: renders in React Server Components; the action slots take client components such as Button. Consumer duties: title and description wording, a heading level that fits the page, and real actions in the slots.
Use Alert for errors.
import { EmptyState } from "@nexera-ui/react";- 5
- examples
- 9
- props
- 4
- live controls
- 1
- platform
- 7
- WCAG criteria
- 11
- blocks use it
Try every prop. Copy the code.
Change the props and the code updates. Check light and dark, LTR and RTL, and phone width.
import { EmptyState } from "@nexera-ui/react";
<EmptyState />Examples 4
The same examples as Storybook, rendered live. Open Code to copy one.
With illustration
Variant=Illustration: the illustration slot replaces the icon tile.
import { Button, EmptyState } from "@nexera-ui/react";
import { LuUsers } from "react-icons/lu";
function Illustration({ height }: { height?: number }) {
return (
<svg viewBox="0 0 160 120" data-expect-height={height}>
<rect x="16" y="20" width="128" height="88" rx="12" className="fill-sunken" />
<rect x="36" y="44" width="56" height="8" rx="4" className="fill-nav-active-bg" />
<rect x="36" y="60" width="88" height="8" rx="4" className="fill-nav-active-bg" />
<circle cx="120" cy="28" r="16" className="fill-brand-subtle" />
</svg>
);
}
<EmptyState
icon={<LuUsers />}
title="Nothing scheduled"
description="Shifts you publish appear here."
primaryAction={<Button size="md">Create shift</Button>}
variant="illustration"
illustration={<Illustration />}
size="md"
/>;
Both actions
Both actions (Show secondary): the secondary action comes first. The row wraps when the container is narrow.
import { Button, EmptyState } from "@nexera-ui/react";
import { LuUsers } from "react-icons/lu";
<EmptyState
icon={<LuUsers />}
title="No employees yet"
description="Add your team one by one or import everyone from a spreadsheet."
primaryAction={<Button size="sm">Add employee</Button>}
secondaryAction={
<Button size="sm" variant="secondary">
Import CSV
</Button>
}
/>;
Long content
A search with no results, without actions. Long titles and descriptions wrap (translation adds 30 to 40 %).
import { Button, EmptyState } from "@nexera-ui/react";
import { LuSearch } from "react-icons/lu";
<EmptyState
icon={<LuSearch />}
title="No employees match the filters you selected for this department and location"
description="Try removing a filter, checking the spelling, or searching for a different name, email address or employee number."
primaryAction={<Button size="sm">Add employee</Button>}
size="md"
/>;
Right to left
Right-to-left: the actions run from the right; the block stays centred.
import { Button, EmptyState } from "@nexera-ui/react";
import { LuUsers } from "react-icons/lu";
<EmptyState
icon={<LuUsers />}
title="لا يوجد موظفون بعد"
description="أضف فريقك واحدًا تلو الآخر أو استورد الجميع من جدول بيانات."
primaryAction={<Button size="sm">إضافة موظف</Button>}
secondaryAction={
<Button size="sm" variant="secondary">
استيراد CSV
</Button>
}
/>;
Props 9
Press "Try it" on a card to load that prop into the playground.
9 props shown
title*NexeraReactNodeWhat is empty, for example "No employees yet". Rendered as a heading (headingLevel). Wraps,
never truncated.
descriptionNexeraReactNodeWhat to do next, for example "Add your team one by one or import everyone from a spreadsheet." Shown when provided.
sizeNexera"sm" | "md" | "lg"Width, type scale and tile size: up to 280, 400 or 480 px wide.
headingLevelNexera1 | 2 | 3 | 4 | 5 | 6Heading level of the title. Pick the level that fits the page outline (WCAG 1.3.1): one below the heading of the section the empty state sits in.
primaryActionNexeraReactNodeMain action, for example
<Button size="sm">Add employee</Button>. Shown when provided, after the secondary action. Use size="sm" with
size="sm" and size="md" with md and lg, as in Figma.
secondaryActionNexeraReactNodeSecond action, for example
<Button variant="secondary" size="sm">Import CSV</Button>. Shown when provided, before the primary action.
variantNexera"icon" | "illustration"Visual above the text: icon shows icon in a round tile, illustration shows illustration.
Visual above the text.
iconNexeraReactNodeGlyph for the tile, for example <IconUsers />.
Shown when provided. Decorative: hidden from assistive technology, so put the meaning in title.
illustrationNexeraReactNodeIllustration: an <img> or <svg> that fills a 96 x 72,
136 x 102 or 160 x 120 px box. Decorative: hidden from assistive technology, so put the meaning in title.
* Required. React Aria props shown are the ones most apps use; the component accepts the rest of its React Aria props too.
Accessible by default.
Built on React Aria, and covered by the WCAG 2.2 evidence generated on every build.
WCAG 2.2 evidence
4 direct · 3 supporting- 1.1.1Non-text ContentLevel A · tested directly
- 1.3.1Info and RelationshipsLevel A · tested directly
- 1.3.2Meaningful SequenceLevel A · supporting test
- 1.4.10ReflowLevel AA · supporting test
- 1.4.12Text SpacingLevel AA · supporting test
- 2.1.1KeyboardLevel A · tested directly
- 4.1.2Name, Role, ValueLevel A · tested directly
Fits any width.
Nexera components respond to the space they are given. Drag the corner of the frame, or pick a width.
Styling hooks
Pass className to add Tailwind classes (merged last). State is exposed as data attributes, so you can style it with variants like data-pressed:.
<EmptyState className="shadow-sm" />Used in blocks
- Forgot passwordSign in and account
- Check your emailSign in and account
- Chart statesDashboards and analytics
- Data tableLists, tables and records
- Filter barLists, tables and records
- People directoryLists, tables and records
- Approvals inboxWork and projects
- NPS surveyFeedback and surveys
- Empty statesStates and system messages
- Error pagesStates and system messages
- Success confirmationStates and system messages
Related components
- AlertAn inline status message about a section or a task: tone icon, title, optional description, actions and close button.
- BannerA page-wide notice across the top of a page or app shell: tone icon, message, optional link and close button on a solid fill.
- CircularProgressShows progress as a ring with the value in the centre.
- ProgressBarShows how far a task has progressed.
- ProgressStepsA segmented progress indicator for a flow with a known number of steps, such as onboarding or a form wizard: a header with "Step 2 of 5" and the step title above one segment per step.
- SpinnerSmall loading indicator.
- SpinnerLabelA spinner with a status message.
- ToastGives the components below it a toast queue through `useToast()` and renders its `ToastRegion`.