v0.0.2
Demos (demo panel, opens in a new tab)

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

Basic usage: view
BLADE

title is a required, short sentence about the state; use description to say in one sentence what to do.

blade
<zb:empty-state title="No orders yet" description="There are no orders recorded for this store this month." />
PropValues
titleRequired state heading
descriptionOptional description

With an icon

With an icon: view
BLADE

The icon slot puts a muted icon above the title; zb:icon at around size="8" works well.

blade
<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>
PropValues
iconSlot: icon above the title

With an action button

With an action button: view
BLADE

The action slot adds a single button below the description that gets the user out of the empty state.

blade
<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>
PropValues
actionSlot: button below the description

First record and no results

First record and no results: view
BLADE

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.

blade
<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?

PropTypeDefaultDescription
title— — Required. State heading
description—nullDescription below the title

Slots: icon: icon above the title · action: action below the description.

Zubazar UI · ZubazarDesigned for people.