Menus & navigation
JS behaviour
Stack menu
A multi-level menu with push/pop between levels and a search that spans every depth; results carry their own trail.
Real scenarios
The component as it is used in a product — not a specimen grid.
Workspace settings, level by level
Items with children push a new level; the back row pops it. Choosing a leaf dispatches nx-select — we toast the label — and the search finds items at any depth, trail included.
A jump-to menu with shortcuts
Open it and type — the keywords make English finds Persian labels. Shortcuts sit on the right like a command palette’s.
Important props
| Prop | Type | Default | What it does |
|---|---|---|---|
| items | array | [] | Each item: id, label, icon, description, shortcut, tone, disabled, keywords, href, event, params and children for the next level. |
| title | string | «منو» | The root level’s title; deeper levels take their parent item’s label. |
| side / align | string | bottom · start | The panel’s side and alignment against the trigger (side: bottom or top). |
| nx-select | event | — | Choosing an item without children fires this event with id and label; the item’s href or event follows. |
| trigger | slot | — | Your own button instead of the default one. |
Snippet
<x-nx::stack-menu title="تنظیمات" x-on:nx-select="$wire.ping('انتخاب شد: ' + $event.detail.label)" :items="[
['id' => 'appearance', 'label' => 'نمایش', 'icon' => 'sun', 'children' => [
['id' => 'theme', 'label' => 'پوسته', 'icon' => 'moon', 'children' => [
['id' => 'light', 'label' => 'روشن'], ['id' => 'dark', 'label' => 'تیره'],
]],
]],
['id' => 'signout', 'label' => 'خروج', 'icon' => 'lock', 'tone' => 'danger'],
]">
<x-slot:trigger><x-nx::button icon="sliders">تنظیمات</x-nx::button></x-slot:trigger>
</x-nx::stack-menu>