MenuBar
A persistent horizontal bar of top-level menus modelled on desktop application menus.
Uses role="menubar" / role="menu" / role="menuitem"; arrow keys traverse menus and items; Esc closes; focus returns to the active trigger.
Variants
Section titled “Variants”With shortcuts
Section titled “With shortcuts”Use MenuBarShortcut to render trailing kbd-chip hints — they are decorative and not announced.
With submenus
Section titled “With submenus”Nest MenuBarSub + MenuBarSubTrigger + MenuBarSubContent for hierarchical actions like “Open recent”.
Checkbox and radio items
Section titled “Checkbox and radio items”Toggle view settings with MenuBarCheckboxItem; pick exclusive options with MenuBarRadioItem inside a MenuBarRadioGroup.
PropTypeDefaultDescription
container
HTMLElement|(() => HTMLElement)
—
className
string
—
Accessibility
Section titled “Accessibility”- The root exposes
role="menubar"; each menu content exposesrole="menu"; items exposerole="menuitem". - Left / Right arrow keys cycle between top-level menus; Up / Down move within an open menu; type-ahead selects matching items.
- Pressing
Esccloses the currently open menu and returns focus to its trigger. MenuBarCheckboxItemcarriesrole="menuitemcheckbox";MenuBarRadioItemcarriesrole="menuitemradio".MenuBarShortcutisaria-hidden="true"— visible only as a hint.
Recipes
Section titled “Recipes”- Mirror desktop conventions:
File,Edit,View,Helpfrom left to right. - Prefer
disableditems over removing them so the menu’s shape is stable between states. - Pair with
CommandPaletteso power users can reach the same actions via keyboard search. - Keep top-level triggers short — single words read fastest at a glance.