Card and tabs
Uses a card and tabs together to show the different parts of a record in a single card.
zb:card · zb:tabs zubazar/ui · free (MIT)
Card with tabs
BLADE
Put zb:tabs in the body of the card; each zb:tab-panel takes its key from the tabs array as value.
<zb:card title="Customer summary">
<zb:slot:actions><zb:button variant="ghost" size="sm">Edit</zb:button></zb:slot:actions>
<zb:tabs :tabs="['info' => 'Info', 'orders' => 'Orders', 'documents' => 'Documents']">
<zb:tab-panel value="info"><p class="text-sm text-dim">Premium member · Istanbul</p></zb:tab-panel>
<zb:tab-panel value="orders"><zb:progress :value="75" label="Annual target" /></zb:tab-panel>
<zb:tab-panel value="documents"><zb:empty-state title="No documents" /></zb:tab-panel>
</zb:tabs>
</zb:card>
| Prop | Values |
|---|---|
tabs | Array of key => title |
tab-panel value | Key of the tab |
Starting tab and pill style
BLADE
Pick the starting tab with active; variant="pills" renders the tabs as filled buttons.
<zb:card title="Kadıköy store" subtitle="KDK-04 · 148 orders">
<zb:tabs variant="pills" active="orders" :tabs="['general' => 'General', 'orders' => 'Orders', 'team' => 'Team']">
<zb:tab-panel value="general"><p class="text-sm text-dim">Store · 14 employees</p></zb:tab-panel>
<zb:tab-panel value="orders"><p class="text-sm text-dim">112 orders shipped this month, 36 waiting.</p></zb:tab-panel>
<zb:tab-panel value="team"><p class="text-sm text-dim">Ayşe Yılmaz, Mehmet Kaya</p></zb:tab-panel>
</zb:tabs>
</zb:card>
| Prop | Values |
|---|---|
active | Key of the starting tab |
variant | underline | pills |
Props
The values the component takes. What are props and slots?
| Prop | Type | Default | Description |
|---|---|---|---|
card: title, subtitle | — | null | Title and the small text below it |
card: collapsible, closable | boolean | false | Collapse and close buttons |
card: padding | boolean | true | false: the content touches the edges |
tabs: tabs | — | [] | key => title |
tabs: active | — | first key | Starting tab |
tabs: variant | — | underline | underline · pills |
tab-panel: value | — | — | Required. Key of the tab |
Slots: card: actions, footer, default content · tabs: zb:tab-panel items.
Developer notes
- Switching tabs happens in the browser; no request goes to the server.
- All the options of each component are described on its own page (Basic card, Tabs).