Menus & navigation
JS behaviour
Admin sidebar
Grouped nav with a brand row, count badges and a spring highlight under the current item; wired inside the shell, server-state outside it.
Real scenarios
The component as it is used in a product — not a specimen grid.
A docs sidebar, linking real pages
Standalone it is pure server state: href items are real links, the active prop places the spring highlight, and numeric badges come out in Persian digits.
Minimal, brand only
One group without a label keeps the bar quiet; the first letter of the brand becomes the mark. Inside the admin shell the same component also follows the shell’s state — buttons pick the active item and the collapse toggle appears.
Important props
| Prop | Type | Default | What it does |
|---|---|---|---|
| groups | array | [] | Each group has label and items; an item: id, label, icon, badge (number or text — numbers get Persian digits), href, navigate, disabled. |
| active | string | null | The active item id; drives aria-current="page" and where the spring highlight sits. |
| brand / brand-mark | string | null | Brand name and mark; without brand-mark the brand’s first letter becomes the mark. |
| wired | bool | false | Turned on automatically inside admin-shell: items follow the shell’s Alpine state and the collapse toggle appears. |
| footer | slot | — | The bottom of the bar: a user chip, a product version, anything. |
Snippet
<x-nx::admin-sidebar brand="مستندات نابو" active="components" label="راهبری مستندات" :groups="[
['label' => 'شروع', 'items' => [
['id' => 'intro', 'label' => 'مقدمه', 'icon' => 'file', 'href' => '/components'],
['id' => 'install', 'label' => 'نصب', 'icon' => 'upload', 'href' => '/components'],
]],
['label' => 'کامپوننتها', 'items' => [
['id' => 'components', 'label' => 'کاتالوگ دموها', 'icon' => 'grid', 'badge' => 31, 'href' => '/components'],
]],
]">
<x-slot:footer>…</x-slot:footer>
</x-nx::admin-sidebar>