A menubar is a row of menus — File, Edit, View. Menubar is the bar, each MenubarMenu is one menu identified by a value, with a MenubarTrigger in the bar and a MenubarContent panel. It shares its content, items, and keyboard model with Dropdown Menu and Context Menu.
The bar owns which menu is open — value holds the open menu's value, or null. Opening one closes another, and while any menu is open, hovering a different trigger switches to it, the way native application menus feel. Pass a signal as value to control it from outside. While a menu is open, the page behind cannot scroll; pass preventScroll: false on that MenubarMenu to leave it scrollable.
Keyboard
The bar is one Tab stop. Left and Right arrows move between triggers (wrapping unless loop: false); Enter, Space, or ArrowDown opens the focused menu with its first item focused. Inside an open menu the shared model applies — arrows move, typing jumps, Enter activates, Escape closes — and Left/Right close the open menu and open its neighbor.
Items and structure
Panels hold the shared menu set: MenubarItem with onSelect and closeOnSelect, MenubarCheckboxItem, MenubarRadioGroup and MenubarRadioItem, MenubarGroup with MenubarGroupHeading, MenubarSeparator, and nested submenus via MenubarSub, MenubarSubTrigger, and MenubarSubContent — inside a submenu, Left and Right move within it rather than switching menubar menus.
Accessibility and styling
The bar is role="menubar" and each trigger role="menuitem" with aria-haspopup and aria-expanded; panels are role="menu". The primitive does not hide closed panels — style MenubarContent against data-state. Triggers expose data-state and data-highlighted; items expose data-highlighted and data-disabled. Every part sets a data-menubar-* attribute.
API Reference
Menubar
The bar. Sets role="menubar", owns which menu is open, and moves focus between the triggers. Renders a Div; extra props are forwarded onto it.
Prop
Type
Default
Description
value
Signal<string | null> | string | null
null
The open menu's value, or null while all are closed. Pass a signal to control it from outside.
loop
boolean
true
Whether arrow keys wrap from the last trigger back to the first.
Data attribute
Value
[data-menubar-root]
Present
[data-orientation]
"horizontal"
MenubarMenu
One menu of the bar. Wraps a trigger and its content.
Prop
Type
Default
Description
value*
string
—
Identifies the menu. Must be unique within the menubar.
preventScroll
boolean
true
When true, the page behind cannot scroll while this menu is open. The panel can still scroll if you give it overflow.
MenubarTrigger
The menu's button in the bar. Sets role="menuitem"; hovering it switches to this menu while another is open. Renders a Button; extra props are forwarded onto it.
Prop
Type
Default
Description
disabled
Signal<boolean> | boolean
false
Prevents opening the menu. Sets disabled and data-disabled.
Data attribute
Value
[data-menubar-trigger]
Present
[data-state]
"open" | "closed"
[data-highlighted]
Present while focused
[data-disabled]
Present when disabled
MenubarContent
The floating panel of items. Sets role="menu". Style it against data-state and data-side; the primitive does not hide it for you. Renders a Div; extra props are forwarded onto it.
Prop
Type
Default
Description
side
"top" | "bottom" | "left" | "right"
"bottom"
Preferred side of the anchor to place the panel.
align
"start" | "center" | "end"
"start"
How the panel aligns along the chosen side.
offset
number
0
Distance in pixels between the anchor and the panel.
loop
boolean
true
Whether arrow keys wrap from the last item back to the first.
Data attribute
Value
[data-menubar-content]
Present
[data-state]
"open" | "closed"
[data-side]
"top" | "bottom" | "left" | "right"
[data-align]
"start" | "center" | "end"
MenubarItem
One action. Sets role="menuitem"; focus follows the pointer. Renders a Div; extra props are forwarded onto it.
Prop
Type
Default
Description
onSelect
() => void
—
Runs when the item is activated with a click, Enter, or Space.
closeOnSelect
boolean
true
Whether selecting the item closes the menu.
disabled
Signal<boolean> | boolean
false
Prevents selecting the item; the keyboard skips it.
Data attribute
Value
[data-menubar-item]
Present
[data-highlighted]
Present while focused
[data-disabled]
Present when disabled
MenubarCheckboxItem
An item holding a checked state. Sets role="menuitemcheckbox" and aria-checked. Renders a Div; extra props are forwarded onto it.
Prop
Type
Default
Description
checked
Signal<boolean> | boolean
false
The checked state; selecting toggles it. Pass a signal to control it from outside.
closeOnSelect
boolean
true
Whether selecting the item closes the menu.
disabled
Signal<boolean> | boolean
false
Prevents selecting the item; the keyboard skips it.
Data attribute
Value
[data-menubar-checkbox-item]
Present
[data-state]
"checked" | "unchecked"
[data-highlighted]
Present while focused
[data-disabled]
Present when disabled
MenubarRadioGroup
Wraps radio items and owns which one is checked. Renders a Div; extra props are forwarded onto it.
Prop
Type
Default
Description
value
Signal<string | null> | string | null
null
The checked item. Pass a signal to control it from outside.
Data attribute
Value
[data-menubar-radio-group]
Present
MenubarRadioItem
One choice in a radio group. Sets role="menuitemradio" and aria-checked. Renders a Div; extra props are forwarded onto it.
Prop
Type
Default
Description
value*
string
—
Identifies the item. Must be unique within the radio group.
closeOnSelect
boolean
true
Whether selecting the item closes the menu.
disabled
Signal<boolean> | boolean
false
Prevents selecting the item; the keyboard skips it.
Data attribute
Value
[data-menubar-radio-item]
Present
[data-state]
"checked" | "unchecked"
[data-highlighted]
Present while focused
[data-disabled]
Present when disabled
MenubarSub
A nested menu. Wraps a sub trigger and its sub content inside a parent content.
Prop
Type
Default
Description
open
Signal<boolean> | boolean
false
The open state. Pass a signal to control it from outside; a boolean seeds uncontrolled state.
MenubarSubTrigger
The item that opens its submenu — on hover after openDelay, ArrowRight, Enter, Space, or click. Sets aria-haspopup and aria-expanded. Renders a Div; extra props are forwarded onto it.
Prop
Type
Default
Description
openDelay
number
100
How long the pointer must rest on the trigger before the submenu opens, in milliseconds.
disabled
Signal<boolean> | boolean
false
Prevents opening the submenu; the keyboard skips the item.
Data attribute
Value
[data-menubar-sub-trigger]
Present
[data-menubar-item]
Present
[data-state]
"open" | "closed"
[data-highlighted]
Present while focused
[data-disabled]
Present when disabled
MenubarSubContent
The submenu's panel, positioned against its trigger. ArrowLeft closes it and returns focus; the keyboard model inside matches the parent content. Renders a Div; extra props are forwarded onto it.
Prop
Type
Default
Description
side
"top" | "bottom" | "left" | "right"
"right"
Preferred side of the sub trigger to place the panel.
align
"start" | "center" | "end"
"start"
How the panel aligns along the chosen side.
offset
number
0
Distance in pixels between the sub trigger and the panel.
loop
boolean
true
Whether arrow keys wrap from the last item back to the first.
Data attribute
Value
[data-menubar-sub-content]
Present
[data-state]
"open" | "closed"
[data-side]
"top" | "bottom" | "left" | "right"
[data-align]
"start" | "center" | "end"
MenubarGroup
Wraps related items in role="group", labeled by the heading placed inside it. Renders a Div; extra props are forwarded onto it.
Data attribute
Value
[data-menubar-group]
Present
MenubarGroupHeading
Names the group it sits in; the group points aria-labelledby at it. Renders a Div; extra props are forwarded onto it.
Data attribute
Value
[data-menubar-group-heading]
Present
MenubarSeparator
A role="separator" line between sections. Renders a Div; extra props are forwarded onto it.
Data attribute
Value
[data-menubar-separator]
Present
MenubarPortal
The core Portal helper, for rendering the panel into another DOM parent to escape overflow and stacking.