Skip to main content
  1. Docs
  2. Components
  3. Feedback

Empty state

The message where content would be: nothing yet, no results, or an error. DataState picks the right one.

Import
@qeetrix/react/experimental
Status
ExperimentalSince 0.0.4
Renders
<div>Server-rendered
Tested
WCAG 2.2 AAaxe on every pull request

01

Import

empty-state.tsx
// Experimental: from the package's experimental entry, until it's stable.
import { EmptyState, DataState } from "@qeetrix/react/experimental";

02

Props

And every native attribute of the element it renders.

PropTypeDefaultWhat it does
titleReactNoderequiredWhat's missing or went wrong: "No users yet".
descriptionReactNode—One or two sentences: why, and what to do.
iconIconSource—A 24px sharp icon.
actionsReactNode—Buttons, one primary at most.
childrenReactNode—Under the actions, small and subtle: a link.
size"page" | "section""page"page for a whole view; section inside a card or a table.
tone"neutral" | "danger""neutral"danger colours the icon.
level2 – 6—Makes the title a heading, when this is the page's main message.
DataState: loading · error · emptyboolean · unknown · boolean—Which state: loading wins, then error, then empty, then the children.
DataState: emptyState · onRetryReactNode · () => void—The EmptyState for empty; Try again for an error.

03

Parts

Each part carries a data-slot, for tests and placement.

data-slotElementWhat it is
empty-state<div>data-size, data-tone.
empty-state-icon<svg>aria-hidden.
empty-state-title<p>Or <h2>–<h6> with level.
empty-state-actions<div>The actions.
data-state<div>DataState's loading, error or empty region: data-state.

04

In a table

Table's empty and error take an EmptyState and a DataState, under its header.

users.tsx
<Table
  empty={<EmptyState size="section" icon={UsersIcon} title="No users yet" … />}
  error={error && <DataState error={error} onRetry={refetch} />}
  …
/>
Next — Empty stateAccessibility