Menubar
Desktop-style menu bar.
Usage
Compose Root > Menu > (Trigger + Content). Menu pairs one trigger with its panel; a menubar holds several. Give
Root an aria-label.
Menubar vs Dropdown Menu
A menubar is not a row of Dropdown Menus. Two behaviours make it a single control rather than several:
- Arrow keys move between the top-level menus, so the whole bar is one tab stop.
- Once one menu is open, hovering a sibling switches to it — no second click. That is the desktop-app behaviour people already expect from a menu bar.
Build it from separate dropdowns and you lose both, which is exactly the kind of regression nobody notices with a mouse.
When not to use it
A menubar is a desktop-application pattern. On a website it is usually the wrong shape.
It assumes a pointer that hovers and a screen wide enough for several always-visible triggers — neither holds on a phone. For site navigation reach for a Navigation Menu; for a handful of actions on a toolbar, a Dropdown Menu or Toolbar. Use a menubar when you are genuinely building an application chrome — an editor, an IDE-like tool.
Props
Menubar.Root
| Prop | Type | Default |
|---|---|---|
class Extra classes merged onto the menubar. | string | — |
value Which menu is open, by its Menu value. Bindable. | string | — |
onValueChange Called when the open menu changes. | (value: string) => void | — |
loop Arrow-key focus wraps at either end. | boolean | true |
dir Reading direction, which flips submenu placement. | 'ltr' | 'rtl' | 'ltr' |
Menubar.Trigger
| Prop | Type | Default |
|---|---|---|
class Extra classes merged onto the trigger. | string | — |
Menubar.Content
| Prop | Type | Default |
|---|---|---|
class Extra classes merged onto the menu panel. | string | — |
Menu, Sub, SubTrigger, SubContent, CheckboxItem, RadioItem, RadioGroup and Arrow are re-exported from Bits unchanged.