Menus & navigation
JS behaviour
Morph tabs
Icon tabs; the active one opens to show its label while the shared pill springs after it.
Real scenarios
The component as it is used in a product — not a specimen grid.
A project header
The active tab opens to name itself while the shared pill springs under it; the panels below swap through the morph and the choice syncs to Livewire.
To do
5
Card 1
Card 2
In progress
3
Card 1
Card 2
Done this week
11
Card 1
Card 2
Active tab on the server:
board
A quiet icon toolbar
Without panels the tabs stay icons — tooltips carry the names. justify moves the row.
Important props
| Prop | Type | Default | What it does |
|---|---|---|---|
| items | array | [] | Each tab: value, label, icon, content and disabled; a tab’s panel comes from the slot named after its value. |
| value / wire:model | string | null | The active tab; wire:model binds it and the panels swap through the morph. |
| justify | string | start | The tab row’s alignment: start, center or end. |
| label | string | null | The tablist’s accessible label. |
Snippet
<x-nx::morph-tabs label="بخشها" :value="$state['tab'] ?? 'home'" wire:model.live="state.tab" :items="[
['value' => 'home', 'label' => 'خانه', 'icon' => 'home'],
['value' => 'inbox', 'label' => 'صندوق', 'icon' => 'mail'],
]">
<x-slot:home>…محتوای خانه…</x-slot:home>
<x-slot:inbox>…محتوای صندوق…</x-slot:inbox>
</x-nx::morph-tabs>