Empty
An empty state with media, title, description and actions.
With an action
No projects yet
A project holds its tasks, invoices and releases in one place.
import { FolderPlusIcon } from "@keyline-icons/react"
import { Button } from "@/components/ui/button"
import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "@/components/ui/empty"
export default function EmptyWithAnAction() {
return (
<Empty>
<EmptyHeader>
<EmptyMedia variant="icon">
<FolderPlusIcon />
</EmptyMedia>
<EmptyTitle>No projects yet</EmptyTitle>
<EmptyDescription>A project holds its tasks, invoices and releases in one place.</EmptyDescription>
</EmptyHeader>
<EmptyContent>
<Button>Create a project</Button>
</EmptyContent>
</Empty>
)
}
Outlined
No invoices this month
Invoices appear here when they are issued.
import { ReceiptIcon } from "@keyline-icons/react"
import { Button } from "@/components/ui/button"
import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "@/components/ui/empty"
export default function EmptyOutlined() {
return (
<Empty className="max-w-md border">
<EmptyHeader>
<EmptyMedia variant="icon">
<ReceiptIcon />
</EmptyMedia>
<EmptyTitle>No invoices this month</EmptyTitle>
<EmptyDescription>Invoices appear here when they are issued.</EmptyDescription>
</EmptyHeader>
<EmptyContent className="flex-row justify-center">
<Button>New invoice</Button>
<Button variant="outline">Import a CSV</Button>
</EmptyContent>
</Empty>
)
}
No results
No tasks match “export”
Check the spelling, or show all tasks.
import { Empty, EmptyDescription, EmptyHeader, EmptyTitle } from "@/components/ui/empty"
export default function EmptyNoResults() {
return (
<Empty>
<EmptyHeader>
<EmptyTitle>No tasks match “export”</EmptyTitle>
<EmptyDescription>
Check the spelling, or <a href="#all-tasks">show all tasks</a>.
</EmptyDescription>
</EmptyHeader>
</Empty>
)
}
Installation
npx shadcn@latest add @khaeli/emptybunx --bun shadcn@latest add @khaeli/emptyInstall @khaeli/foundation first: this item's styling lives in its tokens and [data-slot] rules.
Installs with
- Registry items
- npm packages
- class-variance-authority ^0.7.1
Accessible name
EmptyTitleis adiv, not a heading, and the icon inEmptyMediais decoration.- Name the action by what it creates, such as Create a project, so it makes sense out of context.
Registry JSON
The item as the shadcn CLI reads it, with every file it ships: https://ui.khaeli.com/r/empty.json