Components
Menubar
A visually persistent menu common in desktop applications that provides quick access to a consistent set of commands.
Made by shadcnInstallation
Loading component...
When to use
The Menubar component provides persistent menu access similar to desktop applications. Use this decision tree to determine when it's appropriate:
Usage
import {
Menubar,
MenubarContent,
MenubarItem,
MenubarMenu,
MenubarSeparator,
MenubarShortcut,
MenubarTrigger,
} from "@/components/ui/menubar"<Menubar>
<MenubarMenu>
<MenubarTrigger>File</MenubarTrigger>
<MenubarContent>
<MenubarItem>
New Tab <MenubarShortcut>⌘T</MenubarShortcut>
</MenubarItem>
<MenubarItem>New Window</MenubarItem>
<MenubarSeparator />
<MenubarItem>Share</MenubarItem>
<MenubarSeparator />
<MenubarItem>Print</MenubarItem>
</MenubarContent>
</MenubarMenu>
</Menubar>Examples
Checkbox items
Loading component...
Radio items
Loading component...
Nested submenus
Loading component...
Props
Keyboard interactions
| Key | Action |
|---|---|
Tab into the menubar | Focus lands on the first top-level trigger. |
ArrowLeft / ArrowRight | Moves between top-level menus. |
ArrowDown / Enter / Space | Opens the focused menu and focuses its first item. |
ArrowUp / ArrowDown (inside a menu) | Moves between items. |
ArrowLeft / ArrowRight (inside a menu) | Opens / closes submenus and moves between adjacent menus. |
Home / End | Jumps to first / last item. |
Enter / Space | Activates the focused item. |
Escape | Closes the open menu. |
| Typing a character | Typeahead jumps to the next matching item. |
Accessibility
- The menubar container has
role="menubar"and each top-level triggerrole="menuitem"witharia-haspopup="menu"andaria-expanded. - Focus is roving across both the menubar and each menu; only one trigger is in the tab order.
- Keep labels short and single-level where possible. Deeply nested submenus are hard to reach for motor-impaired
users — consider a
DropdownMenuwithkeepMountedpanels instead. - Open state lives on each child
MenubarMenu(setopen/onOpenChangethere), not on theMenubarroot.
Credits
- We use Base UI for the menubar component.
- We take our inspiration from Shadcn UI for the menubar style.
Recent changes
- patchv1.2.0Pin shipped dependency floors to the version we develop against. Registry items now declare ranges like `^5.1.9` (the actual installed version) instead of collapsing to `^5.0.0`, so consumers start on the known-tested baseline while caret semantics still allow any compatible release within the same major.#133
- minorv1.1.0Theme docs refresh, readability pass on semantic foregrounds, and consumer-facing Base UI regression fixes.#121
- minorv1.1.0Bulk install experience and Dialog polish.#119
- minorv1.0.0Post-Base-UI polish. Public API unchanged.#116
- majorv1.0.0Migrate every Radix-based primitive to `@base-ui/react@^1.4.0` (Base UI).#114
Built by malinskibeniamin. The source code is available on GitHub.