Navigation
Menubar
Desktop-style menus in a bar.
Usage
A bar of menus, like the File / Edit / View bar of a desktop app. Compose Menubar, one MenubarMenu per title, each with a MenubarTrigger and MenubarContent. Items, checkbox and radio items and submenus are the dropdown menu's own parts under a Menubar name.
Nothing chosen yet · sidebar on · default
When to use
- Apps with many commands grouped by area (editors, design tools, admin consoles on desktop).
- Once one menu is open, moving to another title switches to it without another click.
Not for: site navigation (use the navbar or navigation menu) or a single list of actions (use the dropdown menu).
API
Menubar
| Prop | Type | Default | Description |
|---|---|---|---|
| value | string | null | — | Controlled: the value of the open menu. |
| defaultValue | string | null | null | Initial open menu when uncontrolled. |
| onValueChange | (value: string | null) => void | — | Called when the open menu changes. |
MenubarMenu
| Prop | Type | Default | Description |
|---|---|---|---|
| value | string | — | Identifies the menu in the bar value. Generated when omitted. |
MenubarContent takes placement (default bottom-start) and offset (default 6). Also: MenubarItem, MenubarCheckboxItem, MenubarRadioGroup, MenubarRadioItem, MenubarLabel, MenubarSeparator, MenubarGroup, MenubarSub, MenubarSubTrigger and MenubarSubContent with the same props as their DropdownMenu counterparts.
Keyboard
| Key | Action |
|---|---|
| ← / → | On a title: moves to the previous / next title. With a menu open: switches to that menu. |
| ↓ / Enter / Space | On a title: opens the menu with the first item focused. |
| ↑ | On a title: opens the menu with the last item focused. |
| Home / End | On a title: first / last title. |
| ↓ / ↑ / Home / End / A–Z | In a menu: move between items. |
| → / ← | In a menu: opens / closes a submenu; on a plain item moves to the next / previous menu. |
| Esc | Closes the menu and returns focus to its title. |
Accessibility
- Follows the WAI-ARIA menubar pattern: role="menubar" with menuitem titles that have aria-haspopup, aria-expanded and aria-controls.
- The bar is one tab stop (roving tabindex); arrows move within it.
- Each menu is labelled by its title.
Motion
- Titles tint in 150ms; menus pop open from their title (150ms) and fade out in 160ms.
- Switching menus closes one and opens the next at once, with no gap.
- Reduced motion: menus appear without movement.