Menus & navigation JS behaviour

Admin topbar

The topbar row: heading and subheading, a command-search seat with a shortcut hint, actions and a user menu on a native popover.

Real scenarios

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

The orders page, top row

The avatar opens a native-popover menu — here filled through the userMenu slot with our own buttons. Pressing the search seat dispatches nx-search, so a command palette can listen for it.

Orders

24 open right now

Negar Rostami

Sales lead


…the page body would start here.

Custom heading and a live search input

The heading slot carries breadcrumbs and badges; the search slot takes any control — here a plain nx-input bound to Livewire.

Query so far: —

Important props

Important props
Prop Type Default What it does
title / subtitle string null Page title and subtitle; the heading slot takes any structure (breadcrumbs, badges).
drawer string null The mobile drawer popover id — passed automatically inside admin-shell; the menu button renders only with it.
search-placeholder / search-hint string null The search seat text and its shortcut (e.g. ⌘K); the search slot takes a real input. The built-in button dispatches nx-search on click.
user array null name, role, avatar and menu for the user menu; menu entries may carry href or be a divider.
slots — — actions (buttons and dropdowns), heading, search and userMenu.

Snippet

<x-nx::admin-topbar title="سفارش‌ها" subtitle="۲۴ سفارش باز" search-placeholder="جست‌وجوی فرمان…" search-hint="⌘K"
    :user="['name' => 'نگار رستمی', 'role' => 'مدیر فروش', 'menu' => [
        ['label' => 'پروفایل', 'icon' => 'user', 'href' => '/components'],
        ['divider' => true],
        ['label' => 'خروج', 'icon' => 'lock'],
    ]]">
    <x-slot:actions>
        <x-nx::theme-toggle />
        <x-nx::activity-dropdown :items="$activity" />
    </x-slot:actions>
</x-nx::admin-topbar>