This page as markdown: /empty-state.md · Index for agents: /llms.txt · Everything in one file: /llms-full.txt

EmptyState

Status: stable

The centered empty / error block: optional icon or error code, title, description and an action. tone="destructive" makes it an announced error, size="lg" a page-level state, surface="card" a self-contained card.

Keywords: empty, zero state, blank slate, no results, placeholder, onboarding, no data

Usage

Use EmptyState when a content area has no items, no search results, or no first-time setup yet. The title should name the empty condition and the description/action should give the user a next step.

Best practices

Anatomy

Part Required Description
Icon no A decorative cue that reinforces the empty condition.
Title yes The short message naming what is empty.
Description no Supporting copy that explains why the state exists or what to try next.
Action no One clear button or link that moves the user forward.

Props

Name Type Default Description
icon ReactNode — Optional glyph above the title — an <Icon /> takes the muted ink at 3xl; an image or illustration renders as given.
title ReactNode — The headline. Short and direct.
description ReactNode — Optional supporting line beneath the title.
action ReactNode — Optional action below the copy — typically a <Button />.
code ReactNode — A large figure above the title, such as an error code (404).
tone "neutral" | "destructive" "neutral" destructive is an error state: a destructive icon (a warning by default) and role="alert" so it is announced.
size "md" | "lg" "md" lg is page-level: the title is an h2 and the block takes more room. md sits in a panel, list or card.
surface "none" | "card" "none" card draws it as a Card, for an error or empty block standing on its own in a page.

Variants

Tokens used

muted, muted-foreground, foreground, destructive

Accessibility

Related

Examples

With icon and action

import { Button, EmptyState, Icon } from "@sableui/react"

<EmptyState icon={<Icon name="info" />} title="No posts yet" description="Create your first." action={<Button>New post</Button>} />

No search results

import { Button, EmptyState, Icon } from "@sableui/react"

<EmptyState icon={<Icon name="search" />} title="No matching posts" description="Try a different keyword or clear your filters." action={<Button variant="secondary">Clear filters</Button>} />

First-run setup

import { Button, EmptyState, Icon, Row } from "@sableui/react"

<EmptyState surface="card" icon={<Icon name="sparkles" />} title="Start your first project" description="Create a project, import one from a file, or invite collaborators." action={<Row gap={1}><Button>Create project</Button><Button variant="ghost">Import</Button></Row>} />

Page-level error

import { Button, EmptyState } from "@sableui/react"

<EmptyState tone="destructive" size="lg" code="404" title="Page not found" description="The page you are looking for has moved or never existed." action={<Button>Go home</Button>} />

Error card

import { Button, EmptyState } from "@sableui/react"

<EmptyState tone="destructive" surface="card" title="Could not load this project" description="Check your connection and try again." action={<Button variant="secondary">Retry</Button>} />

Empty table body

import { DataTable, EmptyState } from "@sableui/react"

<DataTable data={[]} columns={[{ key: "name", header: "Customer" }, { key: "status", header: "Status" }]} empty={<EmptyState title="No customers yet" description="Customers appear here after the first order." />} />