Menus & navigation
JS behaviour
Fold menu
Each section unfolds like a sheet of paper hanging from the one before; three or four read best and Escape folds them all back.
Real scenarios
The component as it is used in a product — not a specimen grid.
The workspace menu
Three folds read best. Each unfolds from the bottom edge of the one before; Escape folds everything back, and the last fold is our CTA.
A compact two-fold, real links
Links can be hrefs (navigate adds wire:navigate) and the panel can hang from the other side with align="end".
Important props
| Prop | Type | Default | What it does |
|---|---|---|---|
| sections | array | [] | Each section: title and links; a link: label, href or click (an Alpine expression), icon, description and current. |
| label / nav-label | string | «منو» | The trigger text and the panel’s accessible label. |
| align | string | start | Which side of the trigger the panel opens: start or end. |
| navigate | bool | false | Adds wire:navigate to links so navigation happens without a full reload. |
| footer | slot | — | One last fold for a CTA or a language switch. |
Snippet
<x-nx::fold-menu label="محصول" :sections="[
['title' => 'کشف', 'links' => [
['label' => 'داشبورد', 'icon' => 'grid', 'current' => true],
['label' => 'تیکت تازه', 'icon' => 'message', 'description' => 'پاسخ زیر ۲ ساعت'],
]],
['title' => 'حساب', 'links' => [
['label' => 'خروج', 'icon' => 'lock', 'click' => '$wire.ping(\'خروج انجام شد\')'],
]],
]">
<x-slot:footer>
<x-nx::button variant="primary" size="sm" block>ارتقا به پرو</x-nx::button>
</x-slot:footer>
</x-nx::fold-menu>