Menubar
Application menubar with the APG keyboard model, hover switching, submenus, checkbox and radio items.
Built on Dropdown Menu. Installs motion.
Opened poster-v3.tide · rulers on · snap on · fit
Installation
npx shadcn@latest add https://neonkit.heyaadi.com/r/menubar.jsonUsage
import {
Menubar,
MenubarContent,
MenubarItem,
MenubarMenu,
MenubarSeparator,
MenubarTrigger,
} from "@/components/ui/menubar"
<Menubar aria-label="Editor">
<MenubarMenu>
<MenubarTrigger>File</MenubarTrigger>
<MenubarContent>
<MenubarItem shortcut="⌘N">New canvas</MenubarItem>
<MenubarSeparator />
<MenubarItem shortcut="⌘S">Save</MenubarItem>
</MenubarContent>
</MenubarMenu>
</Menubar>Examples
Labels and icons
Radio groups with a label, checkbox items with shortcuts, and icon items that depend on them.
API reference
Menubar
Renders a div with role="menubar". Give it an aria-label.
| Prop | Type | Default |
|---|---|---|
value | stringThe open menu's value. Controlled. | None |
defaultValue | stringInitially open menu when uncontrolled. | null |
onValueChange | (value: string | null) => voidCalled when a menu opens, another takes over, or the bar closes. | None |
loop | booleanLeft and Right wrap from the last menu to the first and back. | true |
color | NeonColorPalette name or hex. Falls back to --neon-accent, then cyan. | inherited |
MenubarMenu
One menu in the bar. Wraps a DropdownMenu whose open state the bar owns.
| Prop | Type | Default |
|---|---|---|
value | stringIdentifies the menu in Menubar's value. | generated |
MenubarTrigger
The menu's title: a button with role="menuitem". Accepts native button attributes.
| Prop | Type | Default |
|---|---|---|
disabled | booleanSkipped by Left and Right. | false |
MenubarContent
The menu panel. Takes every DropdownMenuContent prop.
| Prop | Type | Default |
|---|---|---|
sideOffset | numberGap below the bar, in px. | 8 |
alignOffset | numberLines the panel's edge up with the bar's. | -4 |
MenubarItem, MenubarCheckboxItem, MenubarRadioGroup, MenubarRadioItem, MenubarLabel, MenubarGroup, MenubarSeparator, MenubarSub, MenubarSubTrigger, MenubarSubContent
The Dropdown Menu parts under menubar names, with the same props: shortcut, icon, variant="danger", checked, value, onSelect.
| Prop | Type | Default |
|---|---|---|
shortcut | ReactNodeShown on the right. Display only: wire the key yourself. | None |
onSelect | (event: Event) => voidCalled on click, Enter or Space. The menu closes unless you call preventDefault(). | None |
Accessibility
- Follows the WAI-ARIA menubar pattern: one Tab stop for the bar, Left and Right between titles, Home and End to the ends.
- Enter, Space or ArrowDown opens a menu on its first item; ArrowUp opens it on the last.
- Inside a menu, Left and Right move to the neighbouring menu, except where a submenu claims the key.
- Once a menu is open, hovering another title opens that one. Escape closes the menu and returns focus to its title.