Empty
FeedbackWhat a place shows when it has nothing yet: a list without rows, a search without results, a page the user has no access to. <Empty.Root> centres an Empty.Media (an icon in a tile with variant="icon", or an image; hidden from screen readers), an Empty.Title (a heading, at level 3 by default), an Empty.Description and an Empty.Content with what to do next. Give the root a border (border border-dashed) to mark out an area.
import { Empty } from '@limerdev/zest'; Alert. A place that is still loading: use Skeleton or Spinner, then Empty once you know it's empty.Examples
No rows
An empty list: an icon in a tile, what is missing, and the action that fills it.
Invoices you create or import show up here.
<script lang="ts">
import FileText from '@lucide/svelte/icons/file-text';
import { Button, Empty } from '@limerdev/zest';
</script>
<Empty.Root>
<Empty.Media variant="icon"><FileText /></Empty.Media>
<Empty.Title>No invoices yet</Empty.Title>
<Empty.Description>Invoices you create or import show up here.</Empty.Description>
<Empty.Content>
<Button>New invoice</Button>
<Button variant="outline">Import</Button>
</Empty.Content>
</Empty.Root> No results
No search results, in a dashed area: say what was searched and how to widen it.
Check the spelling, or search by organisation number.
<script lang="ts">
import SearchX from '@lucide/svelte/icons/search-x';
import { Button, Empty } from '@limerdev/zest';
</script>
<Empty.Root class="border border-dashed border-border">
<Empty.Media variant="icon"><SearchX /></Empty.Media>
<Empty.Title>No customers match “acme ltd”</Empty.Title>
<Empty.Description>Check the spelling, or search by organisation number.</Empty.Description>
<Empty.Content>
<Button variant="ghost" size="sm">Clear search</Button>
</Empty.Content>
</Empty.Root> Props
Every part also takes class (merged over its defaults), ref (bindable: the element), children, and child (a snippet that
renders your own element, with props to spread on it).
Empty.Root
No props of its own beyond the common ones.
Empty.Media
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | "default" | "icon" | 'default' | icon sets an icon in a tile of the theme's surface; default shows the children (an image, an avatar) as they are. |
Empty.Title
| Prop | Type | Default | Description |
|---|---|---|---|
| level | 1 | 2 | 3 | 4 | 5 | 6 | 3 | The heading level, for the page's outline. |
Empty.Description
No props of its own beyond the common ones.
Empty.Content
No props of its own beyond the common ones.