EmptyState
import { Button, EmptyState } from "@cherry-design-system/react";
import { Inbox } from "lucide-react";
export function NoProjects() {
return (
<EmptyState
icon={<Inbox />}
title="No projects yet"
description="Create your first project."
actions={<Button>New project</Button>}
/>
);
}EmptyState fills the space of a list or view that has nothing to show yet: an empty project list, a search with no results or a first run. It pairs a heading with optional text and actions.
Examples
No search results
import { Button, EmptyState } from "@cherry-design-system/react";
import { SearchX } from "lucide-react";
export function NoResults({ query, onClear }: { query: string; onClear: () => void }) {
return (
<EmptyState
icon={<SearchX />}
title={`No results for "${query}"`}
description="Check the spelling or try a broader term."
actions={
<Button variant="secondary" onClick={onClear}>
Clear search
</Button>
}
/>
);
}Without an icon
The icon defaults to an inbox. Pass null to hide it.
import { EmptyState } from "@cherry-design-system/react";
export function Quiet() {
return <EmptyState icon={null} title="Nothing here" />;
}Heading level
The title is an <h3> by default. Set headingLevel to fit the page outline.
import { EmptyState } from "@cherry-design-system/react";
export function TopLevel() {
return <EmptyState headingLevel={2} title="No invoices" description="Invoices appear here after your first payment." />;
}Properties
The heading.
Icon shown in a tile above the title. Defaults to an inbox; null hides it.
Supporting text under the title.
Buttons or links under the text.
Heading level of the title. Defaults to 3.
EmptyState renders a <div>, forwards its ref to it and passes every other <div> attribute through. It has no client JavaScript, so it is safe in Server Components.
Styling
| Hook | Values |
|---|---|
.cherry-empty-state | Root element |
| Parts | .cherry-empty-state__icon, __title, __description, __actions |
The icon tile reads --cherry-bg-muted, --cherry-border-default and --cherry-elevation-xs; the title uses the h5 text tokens.
Accessibility
The title is a real heading (headingLevel), followed by plain text. The icon is decorative and hidden from assistive tech.