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

Stat cards

Highlights a single number with its label, an icon and its change from the previous period.

zb:stat-card zubazar/ui · free (MIT)

Basic usage

Basic usage: view
BLADE

label and value are required; the value is shown as is, so add the thousands separator or the unit yourself.

blade
<zb:stat-card label="Total customers" value="4,812" />
PropValues
labelDescription of the number
valueDisplayed value

Change

Change: view
BLADE

change shows the percentage change (0 and above green, negative red); change-label adds a short note next to it.

blade
<div class="grid gap-4 sm:grid-cols-3">
    <zb:stat-card label="Orders this month" value="3,106" :change="12.5" change-label="vs. last month" />
    <zb:stat-card label="Returns" value="214" :change="-4" change-label="vs. last month" />
    <zb:stat-card label="Open tickets" value="38" :change="0" />
</div>
PropValues
changePercentage; 0 and above green, negative red
change-labelText next to the change

Icon and colors

Icon and colors: view
BLADE

icon is shown in a colored box at the top left; color picks the box color (default brand).

blade
<div class="grid gap-4 sm:grid-cols-2 lg:grid-cols-5">
    <zb:stat-card label="Total customers" value="4,812" icon="users" />
    <zb:stat-card label="Delivered" value="3,106" icon="truck" color="success" />
    <zb:stat-card label="Returns" value="214" icon="exclamation-triangle" color="warning" />
    <zb:stat-card label="Canceled" value="12" icon="x-circle" color="danger" />
    <zb:stat-card label="Open tickets" value="38" icon="ticket" color="info" />
</div>
PropValues
iconzb:icon name
colorbrand | success | warning | danger | info

Value colour and hint

Value colour and hint: view
BLADE

value-color colours a figure that is good or bad by itself; hint adds a short note under the value.

blade
<div class="grid gap-4 sm:grid-cols-3">
    <zb:stat-card label="Profit" value="$48,210" value-color="success" hint="Target: $45,000" />
    <zb:stat-card label="Return rate" value="6.4%" value-color="danger" hint="Last month 4.1%" />
    <zb:stat-card label="Pending orders" value="35" hint="12 in transit" />
</div>
PropValues
value-colorsuccess | danger | warning | info…
hintThe note under the value

Extra content

Extra content: view
BLADE

The actions slot sits in the top right corner and the default slot at the bottom of the card; use it for a progress bar or a small chart.

blade
<zb:stat-card label="Monthly target" value="3,106 / 3,400" icon="flag">
    <zb:slot:actions>
        <zb:badge variant="info">September</zb:badge>
    </zb:slot:actions>
    <zb:progress :value="91" size="sm" label="91 percent of the monthly target" />
</zb:stat-card>
PropValues
actionsSlot; top right
default slotBottom of the card

Props

The values the component takes. What are props and slots?

PropTypeDefaultDescription
label— — Required; description of the number
value— — Required; displayed value
change—nullPercentage change; red when negative
change-label—nullText next to the change
icon—nullzb:icon name
color—primaryprimary · secondary · success · danger · warning · info · dark (icon box; brand = primary)
value-color—nullThe value's colour: success · danger · warning · info…; null the text colour
hint—nullA short note under the value

Slots: actions (top right), default content (bottom of the card)

Developer notes

Events, hooks and details
  • The change number is formatted for the application locale, with at most one decimal place.
Zubazar UI · ZubazarDesigned for people.