Installation
npx logic2b@next add menubarUsage
import {
Menubar,
MenubarContent,
MenubarItem,
MenubarMenu,
MenubarTrigger,
} from "@/components/ui/menubar"
<Menubar>
<MenubarMenu>
<MenubarTrigger>File</MenubarTrigger>
<MenubarContent>
<MenubarItem>New Tab</MenubarItem>
<MenubarItem>New Window</MenubarItem>
</MenubarContent>
</MenubarMenu>
</Menubar>
Examples
Checkboxes and radios
Submenus
Accessibility
Built on Radix Menubar, which follows the WAI-ARIA menubar pattern.
- Arrow keys move focus between menus and items; Enter or Space activates the focused item.
- Esc closes the open menu and returns focus to its trigger.
- Typeahead lets you jump to an item by typing its label.
- Checkbox and radio items expose the correct role and checked state to assistive technology.
Live playground
Edit the component props and inspect the exact JSX before copying it. The preview loads only when this section enters the viewport.
Generated JSX
<Menubar
className="w-fit"
aria-label="Project menu"
>
<MenubarMenu>
<MenubarTrigger>Project</MenubarTrigger>
<MenubarContent>
<MenubarItem>New project</MenubarItem>
<MenubarItem>Open…</MenubarItem>
<MenubarSeparator />
<MenubarItem>Export</MenubarItem>
</MenubarContent>
</MenubarMenu>
<MenubarMenu>
<MenubarTrigger>Help</MenubarTrigger>
<MenubarContent>
<MenubarItem>Documentation</MenubarItem>
<MenubarItem>Keyboard shortcuts</MenubarItem>
</MenubarContent>
</MenubarMenu>
</Menubar>API reference
Generated from the public TypeScript exports in src/ui/menubar.tsx.
Menubar
ComponentProps: React.ComponentProps<typeof MenubarPrimitive.Root>MenubarPortal
ComponentProps: React.ComponentProps<typeof MenubarPrimitive.Portal>MenubarMenu
ComponentProps: React.ComponentProps<typeof MenubarPrimitive.Menu>MenubarTrigger
ComponentProps: React.ComponentProps<typeof MenubarPrimitive.Trigger>MenubarContent
ComponentProps: React.ComponentProps<typeof MenubarPrimitive.Content>| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
align | "center" | "end" | "start" | No | "start" | — |
alignOffset | number | No | -4 | — |
sideOffset | number | No | 8 | — |
MenubarGroup
ComponentProps: React.ComponentProps<typeof MenubarPrimitive.Group>MenubarSeparator
ComponentProps: React.ComponentProps<typeof MenubarPrimitive.Separator>MenubarLabel
ComponentProps: React.ComponentProps<typeof MenubarPrimitive.Label> & { inset?: boolean }| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
inset | boolean | No | — | — |
MenubarItem
ComponentProps: React.ComponentProps<typeof MenubarPrimitive.Item> & { inset?: boolean variant?: "default" | "destructive" }| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
inset | boolean | No | — | — |
variant | "default" | "destructive" | No | "default" | — |
MenubarShortcut
ComponentProps: React.ComponentProps<"span">MenubarCheckboxItem
ComponentProps: React.ComponentProps<typeof MenubarPrimitive.CheckboxItem>MenubarRadioGroup
ComponentProps: React.ComponentProps<typeof MenubarPrimitive.RadioGroup>MenubarRadioItem
ComponentProps: React.ComponentProps<typeof MenubarPrimitive.RadioItem>MenubarSub
ComponentProps: React.ComponentProps<typeof MenubarPrimitive.Sub>MenubarSubTrigger
ComponentProps: React.ComponentProps<typeof MenubarPrimitive.SubTrigger> & { inset?: boolean }| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
inset | boolean | No | — | — |
MenubarSubContent
ComponentProps: React.ComponentProps<typeof MenubarPrimitive.SubContent>Accessibility contract
Machine-readable behavior and consumer responsibilities for menubar.
- Support
- Primitive-managed
- Pattern
- menubar
- Radix Menubar
| Keys | Behavior |
|---|---|
| ArrowUp ArrowDown ArrowLeft ArrowRight | Move within the composite control. |
| Enter Space | Activate the focused control. |
| Escape | Close the open surface and restore focus. |
Built-in semantics
- Manages menubar/menu/menuitem roles and roving focus across top-level menus.
Consumer responsibilities
- Use it for application commands, not site navigation, and label icon-only items.