Shadcn Menubar
React menubar for desktop-style File, Edit, and View bars. Built with TypeScript and Tailwind CSS for Next.js using Base UI — nested menus and keyboard shortcuts.
A menubar is a persistent row of menus — File, Edit, View. Click a trigger and the panel opens; once one is open, moving to the next trigger opens that menu. Use it for desktop-style apps, not website navigation.
Looking for a neobrutalism version for shadcn?
Same menubar, thicker borders. The NeoBrutalism menubar is the kit if you want that look.
Usage
import {
Menubar,
MenubarContent,
MenubarGroup,
MenubarItem,
MenubarMenu,
MenubarSeparator,
MenubarShortcut,
MenubarTrigger,
} from "@/components/ui/menubar"<Menubar>
<MenubarMenu>
<MenubarTrigger>File</MenubarTrigger>
<MenubarContent>
<MenubarGroup>
<MenubarItem>
New Tab <MenubarShortcut>⌘T</MenubarShortcut>
</MenubarItem>
<MenubarItem>New Window</MenubarItem>
</MenubarGroup>
<MenubarSeparator />
<MenubarGroup>
<MenubarItem>Share</MenubarItem>
<MenubarItem>Print</MenubarItem>
</MenubarGroup>
</MenubarContent>
</MenubarMenu>
</Menubar>Each MenubarMenu is one trigger plus its panel. value on the root is which menu is open, not which item.
Composition
Checkbox
MenubarCheckboxItem for options that toggle independently. checked is the state.
Radio
MenubarRadioGroup plus MenubarRadioItem when only one value can be on.
Submenu
MenubarSub, MenubarSubTrigger, and MenubarSubContent nest a second panel. Keep it one level.
With Icons
Icons sit in the item before the label. variant="destructive" is the red row.
RTL
Wrap with DirectionProvider and dir="rtl". Submenus open toward the start.
API
Prop
Type
MenubarContent
Prop
Type
MenubarItem
Prop
Type
MenubarCheckboxItem takes checked and onCheckedChange. MenubarRadioGroup takes value and onValueChange. MenubarLabel and MenubarSubTrigger take inset.
Keyboard
| Key | Action |
|---|---|
Space / Enter | Open the focused trigger, or activate the focused item |
ArrowDown | Open the menu, or move to the next item |
ArrowUp | Move to the previous item |
ArrowRight / ArrowLeft | Next / previous trigger. Opens or closes a submenu |
Escape | Close the menu and return to its trigger |
Tab | Leave the menubar |
Once a menu is open, arrowing to the next trigger opens that menu.
Notes
Shortcuts are labels
MenubarShortcut does not bind a key. Show ⌘S in the row, then listen for the combination yourself.
Don’t use this as site navigation — that is a Navigation Menu.
With other components
Same items, one trigger
Context MenuSame items, right-click
ButtonCompanion toolbar
DialogPreferences from File
KbdShortcut next to the label
SeparatorSplit groups in a menu
Questions
Related
Was this page helpful?
Sign in to leave feedback.
Marker
React marker for inline status, system notes, and labeled separators in a thread. Built with TypeScript and Tailwind CSS for Next.js using Base UI — three layouts.
Message
React message for chat rows in a thread or assistant. Built with TypeScript and Tailwind CSS for Next.js using Base UI — avatar, header, footer, start or end.