Base JS behaviour

Nav menu

Horizontal page navigation; a soft pill springs after the pointer and the keyboard, and glides home to the current page (aria-current) when you step away.

Real scenarios

The component as it is used in a product — not a specimen grid.

The shop panel’s top bar

Move the pointer across the links — the soft pill springs after it, and it follows the keyboard the same way. Step out and it glides home to the current page: سفارش‌ها sits bold, carries the accent dot underneath and aria-current="page" for screen readers.

The hrefs here are placeholders so the demo stays put — in the product they come from your routes, and only the page you are on gets current.

Walking the demo pages without a reload

With navigate, every link rides wire:navigate: the next demo swaps in place, no full page load. These are the playground’s own pages — go on, click one and come back. «Nav menu» is the page you are reading, so its aria-current is not staged.

The customer page’s second row

The same menu one level down: a sub-nav under the page heading, named for where it lives — label becomes the nav’s aria-label, so a screen reader announces "بخش‌های صفحهٔ مشتری" instead of a nameless nav.

Maryam Rostami Guild member

Customer since 1402 — 12 orders, all delivered. The overview you would render under this row.

Important props

Important props
Prop Type Default What it does
items array [] A list of ['href' => …, 'label' => …, 'current' => bool]; the current item goes bold, sits on the accent dot, gets aria-current="page" and owns the indicator’s home — in a real product derive current from the request URL.
label string null The nav’s accessible name (aria-label) — e.g. “Panel sections” or “Customer page sections”.
navigate bool false Links ride wire:navigate so the page swaps in place, with no full reload.

Snippet

<x-nx::nav-menu label="بخش‌های پنل" :items="[
    ['href' => '/panel/orders', 'label' => 'سفارش‌ها', 'current' => true],
    ['href' => '/panel/products', 'label' => 'محصولات'],
    ['href' => '/panel/customers', 'label' => 'مشتریان'],
]" navigate />