Empty state
A box for an empty list or a search with no results that says why and suggests the next step.
zb:empty-state zubazar/ui · free (MIT)
Basic usage
title is a required, short sentence about the state; use description to say in one sentence what to do.
<zb:empty-state title="No orders yet" description="There are no orders recorded for this store this month." />
| Prop | Values |
|---|---|
title | Required state heading |
description | Optional description |
With an icon
The icon slot puts a muted icon above the title; zb:icon at around size="8" works well.
<zb:empty-state title="No documents uploaded" description="The customer's invoices and contract documents are listed here.">
<zb:slot:icon><zb:icon name="folder-open" size="8" stroke="1.5" /></zb:slot:icon>
</zb:empty-state>
| Prop | Values |
|---|---|
icon | Slot: icon above the title |
With an action button
The action slot adds a single button below the description that gets the user out of the empty state.
<zb:empty-state title="No records found" description="Try changing your search or filter criteria.">
<zb:slot:icon><zb:icon name="magnifying-glass" size="8" stroke="1.5" /></zb:slot:icon>
<zb:slot:action><zb:button variant="white" size="sm">Clear filters</zb:button></zb:slot:action>
</zb:empty-state>
| Prop | Values |
|---|---|
action | Slot: button below the description |
First record and no results
Tell the two cases apart: when there are no records at all, guide the user to create the first one; when a search or filter returns nothing, suggest changing the search.
<div class="grid gap-4 md:grid-cols-2">
<zb:empty-state title="No products added yet" description="Add the first product to start selling.">
<zb:slot:icon><zb:icon name="cube" size="8" stroke="1.5" /></zb:slot:icon>
<zb:slot:action><zb:button size="sm">New Product</zb:button></zb:slot:action>
</zb:empty-state>
<zb:empty-state title="No results found" description="No products match “headphnes”.">
<zb:slot:icon><zb:icon name="magnifying-glass" size="8" stroke="1.5" /></zb:slot:icon>
<zb:slot:action><zb:button variant="white" size="sm">Clear search</zb:button></zb:slot:action>
</zb:empty-state>
</div>
Props
The values the component takes. What are props and slots?
| Prop | Type | Default | Description |
|---|---|---|---|
title | — | — | Required. State heading |
description | — | null | Description below the title |
Slots: icon: icon above the title · action: action below the description.