Tabs
Splits content into tabs shown in the same area; switching tabs does not reload the page.
zb:tabs zubazar/ui · free (MIT)
Basic usage
Tabs are generated from the tabs array (key => title); the value of each zb:tab-panel matches a key.
<zb:tabs :tabs="['general' => 'General', 'orders' => 'Orders', 'history' => 'History']">
<zb:tab-panel value="general"><p class="text-sm text-dim">Premium member · Kadıköy, Istanbul</p></zb:tab-panel>
<zb:tab-panel value="orders"><p class="text-sm text-dim">Last order: September 12, 2026</p></zb:tab-panel>
<zb:tab-panel value="history"><p class="text-sm text-dim">9 orders and 1 return in 2026.</p></zb:tab-panel>
</zb:tabs>
| Prop | Values |
|---|---|
tabs | ['key' => 'Title', …] |
value (tab-panel) | Matching tab key |
Pills
variant="pills" shows the selected tab filled; suited to filters or view switches.
<zb:tabs variant="pills" :tabs="['all' => 'All', 'pending' => 'Pending', 'delivered' => 'Delivered']">
<zb:tab-panel value="all"><p class="text-sm text-dim">148 orders</p></zb:tab-panel>
<zb:tab-panel value="pending"><p class="text-sm text-dim">36 orders are waiting to ship.</p></zb:tab-panel>
<zb:tab-panel value="delivered"><p class="text-sm text-dim">112 orders were delivered.</p></zb:tab-panel>
</zb:tabs>
| Prop | Values |
|---|---|
variant | underline | pills |
Card tabs
variant="cards" joins the open tab to the framed panel below it; suited to settings and detail pages.
<zb:tabs variant="cards" :tabs="['general' => 'General', 'shipping' => 'Shipping', 'invoice' => 'Invoice']">
<zb:tab-panel value="general">Store name, currency and time zone.</zb:tab-panel>
<zb:tab-panel value="shipping">Carriers and the free shipping threshold.</zb:tab-panel>
<zb:tab-panel value="invoice">Invoice details and e-invoice settings.</zb:tab-panel>
</zb:tabs>
| Prop | Values |
|---|---|
variant | underline | pills | cards |
Initial tab
active sets the tab selected on load; without it, the first key is selected.
<zb:tabs :active="2025" :tabs="[2026 => '2026', 2025 => '2025', 2024 => '2024']">
<zb:tab-panel value="2026"><p class="text-sm text-dim">2026: 9 orders</p></zb:tab-panel>
<zb:tab-panel value="2025"><p class="text-sm text-dim">2025: 12 orders, 1 return</p></zb:tab-panel>
<zb:tab-panel value="2024"><p class="text-sm text-dim">2024: 11 orders</p></zb:tab-panel>
</zb:tabs>
| Prop | Values |
|---|---|
active | Tab key |
Composing from parts
Write the tabs with zb:tabs.trigger inside zb:tabs.list and their contents with zb:tabs.panel; wire:model binds the open tab to a Livewire property.
<zb:tabs wire:model="activeTab" variant="underline" size="md">
<zb:tabs.list aria-label="Store overview">
<zb:tabs.trigger value="overview">Overview</zb:tabs.trigger>
<zb:tabs.trigger value="orders" badge="8">Orders</zb:tabs.trigger>
<zb:tabs.trigger value="settings">Settings</zb:tabs.trigger>
</zb:tabs.list>
<zb:tabs.panel value="overview">
<div class="grid gap-4 sm:grid-cols-3">
<zb:stat-card label="Orders" value="142" icon="shopping-bag" />
<zb:stat-card label="Delivered" value="118" icon="check-circle" color="success" />
<zb:stat-card label="Pending" value="24" icon="clock" color="warning" />
</div>
</zb:tabs.panel>
<zb:tabs.panel value="orders">
<ul class="divide-y divide-line-soft text-sm">
<li class="flex items-center justify-between py-2.5">
<span class="text-ink">Cumhuriyet Dist., 12th St. No. 4</span>
<zb:badge variant="success">Delivered</zb:badge>
</li>
<li class="flex items-center justify-between py-2.5">
<span class="text-ink">Atatürk Ave. No. 87 Apt. 3</span>
<zb:badge variant="warning">On the way</zb:badge>
</li>
</ul>
</zb:tabs.panel>
<zb:tabs.panel value="settings">
<p class="text-sm text-dim">Store manager: Mehmet Kaya. Shipping cutoff 15:00; orders placed after that ship the next business day.</p>
</zb:tabs.panel>
</zb:tabs>
| Prop | Values |
|---|---|
wire:model | Livewire property the open tab is bound to |
size | sm · md · lg |
zb:tabs.trigger | value, badge, icon, disabled |
zb:tabs.panel | value |
Props
The values the component takes. What are props and slots?
| Prop | Type | Default | Description |
|---|---|---|---|
tabs | — | [] | key => title; the key is a string or a number |
active | — | first key | Tab selected on load (compared as a string) |
variant | — | underline | underline · pills · cards |
tab-panel: value | — | — | Required; matching tab key |
size | — | md | sm · md · lg |
wire:model · x-model | — | — | Binds the open tab two-way to a property |
tabs.trigger: value · badge · icon · disabled | — | — | value is required; badge is a number or short text, icon an icon name |
tabs.panel: value | — | — | Required; the matching tabs.trigger value |
Advanced
Inside a card
Shorten long pages by splitting record details into tabs inside a card. The class and attributes given to zb:tabs go to the root element, and those given to zb:tab-panel to the panel.
<zb:card title="Customer card" subtitle="Ayşe Yılmaz · #04112">
<zb:tabs variant="pills" :tabs="['general' => 'General', 'orders' => 'Orders', 'invoices' => 'Invoices']">
<zb:tab-panel value="general"><p class="text-sm text-dim">Premium member · Kadıköy, Istanbul</p></zb:tab-panel>
<zb:tab-panel value="orders"><p class="text-sm text-dim">Last order: September 12, 2026</p></zb:tab-panel>
<zb:tab-panel value="invoices" class="py-2"><zb:empty-state title="No invoices" /></zb:tab-panel>
</zb:tabs>
</zb:card>
Pill tabs with icons
variant="pills" draws filled tabs and wraps them to the next line on narrow screens; a disabled tab cannot be selected and is skipped by the keyboard.
<zb:tabs variant="pills" active="team">
<zb:tabs.list aria-label="Support view">
<zb:tabs.trigger value="tickets" icon="inbox">Tickets</zb:tabs.trigger>
<zb:tabs.trigger value="team" icon="users" badge="6">Team members</zb:tabs.trigger>
<zb:tabs.trigger value="report" icon="chart-bar">Report</zb:tabs.trigger>
<zb:tabs.trigger value="archive" icon="archive-box" disabled>Archive</zb:tabs.trigger>
</zb:tabs.list>
<zb:tabs.panel value="tickets">
<p class="text-sm text-dim">142 tickets were opened today; 4 of them are marked urgent.</p>
</zb:tabs.panel>
<zb:tabs.panel value="team">
<p class="text-sm text-dim">6 team members are online: 5 are answering tickets and 1 is on a break.</p>
</zb:tabs.panel>
<zb:tabs.panel value="report">
<p class="text-sm text-dim">September 2026: 3,106 tickets, 94% resolved on the first reply.</p>
</zb:tabs.panel>
<zb:tabs.panel value="archive">Archive</zb:tabs.panel>
</zb:tabs>
Developer notes
- Pill tabs wrap to the next line when they do not fit.
- Keys can be numbers; because
activeandvalueare compared as strings,:active="2025"matchesvalue="2025". wire:modelbinds the open tab two-way; initialize the property with a value, otherwise the first tab opens.
Accessibility
- ARIA and roles
- The row has
role="tablist", each tabrole="tab"and each panelrole="tabpanel". A tab points to its panel witharia-selectedandaria-controls; the panel is labelled by its tab througharia-labelledby. The ids are unique perzb:tabs. - Keyboard
- Left and Right arrows move to the previous or next tab and open it; Home and End go to the first and last tab. Movement wraps at the ends and skips disabled tabs.
- Focus
- Only the open tab is in the tab order (
tabindex="0", the others-1). The next Tab moves into the panel, which hastabindex="0". Keyboard focus shows an outline on the tab. - Disabled
disabledsets the realdisabledattribute: the tab cannot be clicked or focused, and the arrow keys skip it.- What you provide
- To name the tab row, write the tabs in parts and put
aria-labelonzb:tabs.list; with the classictabsarray, attributes go on the root element. Give an icon-only tab anaria-label.