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

Cards with actions

Puts actions such as a dropdown, buttons, collapsing and closing in the card header.

zb:card zubazar/ui-pro

PRO

This component is in Zubazar UI Pro; Zubazar UI Pro brings Zubazar UI with it. Installing Zubazar UI Pro →

Buttons, collapsing and closing

Buttons, collapsing and closing: view
BLADE

The actions content stays to the left of the collapse and close buttons; keep one or two actions in the header and move the rest to a dropdown.

blade
<zb:card title="Daily summary" collapsible closable>
    <zb:slot:actions>
        <zb:button size="sm" variant="ghost">All</zb:button>
    </zb:slot:actions>
    <p class="text-sm text-dim">214 orders came in today; 18 orders were canceled.</p>
</zb:card>
PropValues
collapsibletrue | false
closabletrue | false

Locking while refreshing

Locking while refreshing: view
BLADE

Wrap the card in a relative container and put an zb:loading-overlay next to it; the card stays locked while the show expression is true.

blade
<div class="relative" x-data="{ loading: false }">
    <zb:card title="Pending orders">
        <zb:slot:actions>
            <zb:button size="sm" variant="ghost" x-on:click="loading = true; setTimeout(() => loading = false, 1500)">Refresh</zb:button>
        </zb:slot:actions>
        <p class="text-sm text-dim">36 orders are waiting to ship.</p>
    </zb:card>
    <zb:loading-overlay show="loading" />
</div>
PropValues
show (loading-overlay)Alpine expression

Refreshing with Livewire

BLADE

In a Livewire component, give the overlay the name of the action with target; while that action runs, the card is locked automatically.

blade
<div class="relative">
    <zb:card title="Today's orders">
        <zb:slot:actions>
            <zb:button size="sm" variant="ghost" wire:click="refresh">Refresh</zb:button>
        </zb:slot:actions>
        …
    </zb:card>
    <zb:loading-overlay target="refresh" />
</div>
PropValues
target (loading-overlay)Livewire action name

Props

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

PropTypeDefaultDescription
title, subtitle—nullHeader area
collapsiblebooleanfalseCollapse button in the header
closablebooleanfalseClose button in the header
paddingbooleantruefalse: body without padding
loading-overlay: show · target—nullAlpine expression · Livewire action

Slots: actions (right of the header), footer (footer), default content (body)

Developer notes

Events, hooks and details
  • Give an icon-only trigger an aria-label.
Zubazar UI · ZubazarDesigned for people.