Display
Empty
Placeholder for a list or page with nothing in it yet. It says why it is empty and offers the next step.
import * as Empty from '@statix/ui/empty';Examples
Basic
Icon in a soft circle, title, description and one action.
<script lang="ts">
import * as Empty from '@statix/ui/empty';
import { Button } from '@statix/ui/button';
import MailIcon from '@lucide/svelte/icons/mail';
import PlusIcon from '@lucide/svelte/icons/plus';
</script>
<Empty.Root>
<Empty.Header>
<Empty.Media variant="icon">
<MailIcon />
</Empty.Media>
<Empty.Title>No mailboxes yet</Empty.Title>
<Empty.Description>
Create a mailbox to send and receive email as you@yoga-berger.de.
</Empty.Description>
</Empty.Header>
<Empty.Content>
<Button>
<PlusIcon data-icon="inline-start" />
Create mailbox
</Button>
</Empty.Content>
</Empty.Root>Inside a card
The common case: a card section with no entries yet.
Send mail for one address on to another.
<script lang="ts">
import * as Card from '@statix/ui/card';
import * as Empty from '@statix/ui/empty';
import { Button } from '@statix/ui/button';
import ArrowRightLeftIcon from '@lucide/svelte/icons/arrow-right-left';
</script>
<Card.Root class="w-full max-w-xl">
<Card.Header>
<Card.Title>Forwards</Card.Title>
<Card.Description>Send mail for one address on to another.</Card.Description>
</Card.Header>
<Card.Content>
<Empty.Root class="rounded-lg bg-secondary py-10">
<Empty.Header>
<Empty.Media variant="icon" class="bg-card">
<ArrowRightLeftIcon />
</Empty.Media>
<Empty.Title>No forwards</Empty.Title>
<Empty.Description
>For example, send kurse@yoga-berger.de to your own inbox.</Empty.Description
>
</Empty.Header>
<Empty.Content>
<Button variant="dark" size="sm">Add forward</Button>
</Empty.Content>
</Empty.Root>
</Card.Content>
</Card.Root>Accent icon
media variant="accent" for empty states that invite a first step.
<script lang="ts">
import * as Empty from '@statix/ui/empty';
import { Button } from '@statix/ui/button';
import GlobeIcon from '@lucide/svelte/icons/globe';
</script>
<Empty.Root>
<Empty.Header>
<Empty.Media variant="accent">
<GlobeIcon />
</Empty.Media>
<Empty.Title>Get your first domain</Empty.Title>
<Empty.Description>
Search for a name or move a domain you already own. <a href="#help">How moving works</a>
</Empty.Description>
</Empty.Header>
<Empty.Content class="flex-row justify-center gap-2">
<Button>Search domain</Button>
<Button variant="outline">Move a domain</Button>
</Empty.Content>
</Empty.Root>Dashed outline
Add class="border" for a dashed drop area or slot.
<script lang="ts">
import * as Empty from '@statix/ui/empty';
import { Button } from '@statix/ui/button';
import UploadIcon from '@lucide/svelte/icons/upload';
</script>
<Empty.Root class="max-w-lg border">
<Empty.Header>
<Empty.Media variant="icon">
<UploadIcon />
</Empty.Media>
<Empty.Title>Upload a backup</Empty.Title>
<Empty.Description>Drop a .zip or .tar.gz file here, up to 2 GB.</Empty.Description>
</Empty.Header>
<Empty.Content>
<Button variant="outline" size="sm">Choose file</Button>
</Empty.Content>
</Empty.Root>Guidelines
Do
- Name what is missing in the title: "No mailboxes yet".
- Explain in one sentence what the customer gets once there is content.
- Offer one main action. Add a secondary link only when it helps, for example to support.
Don't
- Don’t blame the customer: avoid "You have not created any mailboxes".
- Don’t use an empty state for errors. Use an Alert with the destructive variant.
Accessibility
- The parts are plain <div> elements. If the empty state replaces a list, keep the list heading above it so the page outline stays the same.
- The icon is decorative. The title carries the message.
- Use a heading element inside Empty.Title when it starts a section.
API reference
Empty.Root
renders<div> and accepts its attributesCentred column with 48px vertical padding. Add class="border" for a dashed outline.
| Prop | Type | Default |
|---|---|---|
ref bind | HTMLDivElement | null The rendered element. | – |
class | ClassValue Merged with the base classes; yours win. | – |
| Data attribute | Meaning |
|---|---|
data-slot="empty" | Always present. |
Empty.Header
renders<div> and accepts its attributesGroups media, title and description.
| Data attribute | Meaning |
|---|---|
data-slot="empty-header" | Always present. |
Empty.Media
renders<div> and accepts its attributes| Prop | Type | Default |
|---|---|---|
variant | 'default' | 'icon' | 'accent' icon puts the icon in a 56px bg-2 circle, accent in a primary-soft circle. default leaves it as is. | 'default' |
| Data attribute | Meaning |
|---|---|
data-slot="empty-icon" | Always present (shadcn name). |
data-variant | The current variant. |
Empty.Title
renders<div> and accepts its attributestext-subtitle (17/500) in ink.
| Data attribute | Meaning |
|---|---|
data-slot="empty-title" | Always present. |
Empty.Description
renders<div> and accepts its attributesBody text in muted. Links inside are underlined.
| Data attribute | Meaning |
|---|---|
data-slot="empty-description" | Always present. |
Empty.Content
renders<div> and accepts its attributesHolds the actions.
| Data attribute | Meaning |
|---|---|
data-slot="empty-content" | Always present. |