Empty
What to show when there is nothing yet: an optional 40px icon box, a 20px title, a short description and the next actions.
Installation
npx shadcn@latest add @sevenone/emptyUsage
import {
Empty,
EmptyContent,
EmptyDescription,
EmptyHeader,
EmptyMedia,
EmptyTitle,
} from "@/components/ui/empty"Examples
With an icon
No Projects Yet
You have not created any projects yet. Get started by creating your first project.
Learn More
<Empty>
<EmptyHeader>
<EmptyMedia variant="icon">
<Folder aria-hidden="true" />
</EmptyMedia>
<EmptyTitle>No Projects Yet</EmptyTitle>
<EmptyDescription>
You have not created any projects yet. Get started by creating your first project.
</EmptyDescription>
</EmptyHeader>
<EmptyContent>
<div className="flex gap-2">
<Button>Create Project</Button>
<Button variant="outline">Import Project</Button>
</div>
</EmptyContent>
<Button variant="link" asChild>
<a href="/docs">Learn More <ExternalLink aria-hidden="true" /></a>
</Button>
</Empty>Outline
Add border for the dashed outline.
No results
Try another search term or clear the filters.
<Empty className="border">
<EmptyHeader>
<EmptyTitle>No results</EmptyTitle>
<EmptyDescription>Try another search term or clear the filters.</EmptyDescription>
</EmptyHeader>
<EmptyContent>
<Button variant="outline">Clear filters</Button>
</EmptyContent>
</Empty>Accessibility
- Say what is empty and what people can do next, in plain words.
- The icon is decoration, so mark it aria-hidden.
- If the empty state appears after a search, announce the result count with a live region.