Skip to content
Esc
↑↓navigate↵open⌘Jpreview
On this page

Empty for Astro

Astro empty-state parts for lists, searches, and unfinished setup.

404 - Page Not Found
No page matches this address. Return to the index to choose another page.

Installation

bunx --bun shadcn@latest add @gnostic/empty

Usage

import {
    Empty,
    EmptyContent,
    EmptyDescription,
    EmptyHeader,
    EmptyMedia,
    EmptyTitle,
} from "@/components/ui/empty"
---
import Inbox from "@lucide/astro/icons/inbox"

import { Button } from "@/components/ui/button"
import {
  Empty,
  EmptyContent,
  EmptyDescription,
  EmptyHeader,
  EmptyMedia,
  EmptyTitle,
} from "@/components/ui/empty"
---

<Empty>
  <EmptyHeader>
    <EmptyMedia variant="icon">
      <Inbox />
    </EmptyMedia>
    <EmptyTitle>No data</EmptyTitle>
    <EmptyDescription>No data found.</EmptyDescription>
  </EmptyHeader>
  <EmptyContent>
    <Button>Add data</Button>
  </EmptyContent>
</Empty>

Composition

Arrange the parts as shown for an Empty state:

Empty
├── EmptyHeader
│   ├── EmptyMedia
│   ├── EmptyTitle
│   └── EmptyDescription
└── EmptyContent

Examples

Default

Support Agent
Need help?
Send the page address and a short description of the issue so the team can check it.

Notes

  • Use EmptyHeader when you want the media, title, and description grouped as one block.
  • EmptyMedia variant="icon" is a good default for simple status states.
  • Add EmptyContent only when the empty state needs an action such as retry, clear filters, or go back.

API Reference

Read the installed source for the complete prop types.

When to use Empty

Use Empty where content will appear after an action or data change. Explain why the area is empty and give one useful next step. Add media only when it helps explain the state.

Keyboard and behavior

Empty is static markup. Actions inside it use normal links or buttons. For search results updated by a script, announce the result count through an appropriate live region in your application.

Theme and layout

Spacing and muted text make the message distinct without a heavy surface. Check the action row at narrow widths and avoid fixed heights that create large blank regions.