Skip to content

MenuBar

A persistent horizontal bar of top-level menus modelled on desktop application menus.

  • stable
  • since v0.1.0
  • 4.5 kB
  • overlay
  • menu
  • accessible

Uses role="menubar" / role="menu" / role="menuitem"; arrow keys traverse menus and items; Esc closes; focus returns to the active trigger.

Preview
Open
tsx

Use MenuBarShortcut to render trailing kbd-chip hints — they are decorative and not announced.

Preview
Open
tsx

Nest MenuBarSub + MenuBarSubTrigger + MenuBarSubContent for hierarchical actions like “Open recent”.

Preview
Open
tsx

Toggle view settings with MenuBarCheckboxItem; pick exclusive options with MenuBarRadioItem inside a MenuBarRadioGroup.

Preview
Open
tsx
PropTypeDefaultDescription
container
HTMLElement|(() => HTMLElement)
className
string
  • The root exposes role="menubar"; each menu content exposes role="menu"; items expose role="menuitem".
  • Left / Right arrow keys cycle between top-level menus; Up / Down move within an open menu; type-ahead selects matching items.
  • Pressing Esc closes the currently open menu and returns focus to its trigger.
  • MenuBarCheckboxItem carries role="menuitemcheckbox"; MenuBarRadioItem carries role="menuitemradio".
  • MenuBarShortcut is aria-hidden="true" — visible only as a hint.
  • Mirror desktop conventions: File, Edit, View, Help from left to right.
  • Prefer disabled items over removing them so the menu’s shape is stable between states.
  • Pair with CommandPalette so power users can reach the same actions via keyboard search.
  • Keep top-level triggers short — single words read fastest at a glance.