Overview
Menubar provides a horizontal menu bar component similar to desktop application menus.
- Use it for application toolbars with dropdown menus.
- Supports nested menus, radio groups, and checkbox items.
- Built on Base UI Menubar with integrated dropdown management.
- Includes keyboard navigation and focus management.
Installation
Import
Basic Example
Advanced Example
Size Scale
Menubar supports xs | sm | md | lg | xl sizing that affects all menu triggers and content.
API Reference
Menubar
Root menubar container with size context.Size of the menubar:
xs | sm | md | lg | xl.MenubarMenu
Individual menu within the menubar (wraps DropdownMenu).Size override for this menu.
MenubarTrigger
Button that opens the menu dropdown.MenubarContent
Dropdown content container.Alignment of the dropdown relative to trigger.
Distance from the trigger.
MenubarItem
Standard menu item.Whether the item is disabled.
MenubarLinkItem
Menu item that acts as a link.URL for the link.
MenubarCheckboxItem
Menu item with checkbox state.Whether the checkbox is checked.
Callback when checked state changes.
MenubarRadioGroup
Group of mutually exclusive radio items.Currently selected value.
Callback when selection changes.
MenubarRadioItem
Individual radio option within a group.Unique value for this option.
MenubarSeparator
Visual separator between menu items.MenubarShortcut
Keyboard shortcut display (typically right-aligned).MenubarSub
Nested submenu container.MenubarSubTrigger
Trigger for opening a submenu.MenubarSubContent
Content of a submenu.MenubarLabel
Non-interactive label for grouping items.MenubarGroup
Semantic grouping container.Accessibility
- Base UI handles ARIA menubar semantics and keyboard navigation.
- Use arrow keys to navigate between menus and items.
- Enter/Space to activate items.
- Escape to close menus.
- Checkbox and radio items announce their state.
SSR and RSC Notes
- Menubar is client-interactive (
"use client"). - Portal-based positioning ensures dropdown appears above other content.
- Use client boundaries when integrating into server components.
Styling and Tokens
- Default styles use semantic tokens (
bg-background,border-border,text-foreground). - Menu content includes shadow and border for elevation.
- Shortcuts typically use
text-muted-foregroundfor subtle appearance.
Troubleshooting
- Menu not opening: ensure
MenubarTriggerandMenubarContentare both insideMenubarMenu. - Shortcuts not visible: wrap shortcut text in
<MenubarShortcut>component. - Checkbox state not updating: use controlled
checkedprop withonCheckedChange. - Submenu not appearing: verify
MenubarSubTriggerandMenubarSubContentare insideMenubarSub.