Components
Menubar
A persistent horizontal command bar, the kind that sits at the top of a desktop application. Each item opens a dropdown of grouped commands.
Menubar is for application commands, not navigation. For moving around a site or app, use Navigation Menu or Sidebar.
Preview
Rendered with live Cognition tokens. Open a menu and arrow across the bar, no dark: classes.
Variants
Default
With keyboard shortcuts
With submenus
With separators
With checkboxes
With radio groups
Menus compose shortcuts, submenus, separators, checkboxes, and radio groups. The panels are shown open for reference.
States
Closed. The resting bar.
Item open.
Nested item hover.
Item disabled.
Checkbox checked.
Radio selected.
A menu opens on click, so the open, hover, and nested states render statically. The preview opens the real menus.
API
Don't and Do
Don't use a Menubar to move between pages or sections. It reads as an application command surface, so filling it with destinations confuses commands with navigation. Use Navigation Menu or Sidebar for getting around.
<Menubar>
<MenubarMenu>
<MenubarTrigger>File</MenubarTrigger>
<MenubarContent>
<MenubarItem>
New Tab <MenubarShortcut>⌘T</MenubarShortcut>
</MenubarItem>
</MenubarContent>
</MenubarMenu>
</Menubar>Use it for desktop application command surfaces, the File, Edit, View, Help pattern, where persistent access to grouped commands is expected.
import {
Menubar,
MenubarContent,
MenubarItem,
MenubarMenu,
MenubarShortcut,
MenubarTrigger,
} from "@/components/ui/menubar";
export function AppMenubar() {
return (
<Menubar>
<MenubarMenu>
<MenubarTrigger>File</MenubarTrigger>
<MenubarContent>
<MenubarItem>
New Tab <MenubarShortcut>⌘T</MenubarShortcut>
</MenubarItem>
<MenubarItem>New Window</MenubarItem>
</MenubarContent>
</MenubarMenu>
</Menubar>
);
}