pnpm dlx shadcn@latest add "https://godui.design/r/menubar.json"
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>
Built on Radix Menubar Root; accepts all its props.
| Prop | Type | Default | Description |
|---|
value | string | none | Controlled value of the open menu. Empty string when none is open. |
defaultValue | string | none | Initially open menu when uncontrolled. |
onValueChange | (value: string) => void | none | Called when the open menu changes. |
loop | boolean | true | Wrap keyboard focus from the last trigger to the first. |
dir | "ltr" | "rtl" | none | Reading direction. Inherits from DirectionProvider when unset. |
Built on Radix Menubar Menu; wraps one trigger and its content.
| Prop | Type | Default | Description |
|---|
value | string | none | Identifies the menu for the bar's value. Generated when unset. |
Built on Radix Menubar Trigger; renders a <button> and accepts all its props.
| Prop | Type | Default | Description |
|---|
disabled | boolean | none | Prevents the menu from opening. |
asChild | boolean | false | Render the child element instead, merging props via Radix Slot. |
Built on Radix Menubar Content, rendered in a portal; accepts all its props. While it animates out (data-state="closed") it ignores outside focus and presses, so it can't close the menu you hop to. Your onInteractOutside, onFocusOutside and onPointerDownOutside still run.
| Prop | Type | Default | Description |
|---|
side | "top" | "right" | "bottom" | "left" | "bottom" | Preferred side of the trigger. Flips when it would collide. |
sideOffset | number | 8 | Distance from the trigger in px. |
align | "start" | "center" | "end" | "start" | Alignment against the trigger. |
alignOffset | number | -4 | Offset from the align position in px. |
loop | boolean | false | Wrap keyboard focus from the last item to the first. |
avoidCollisions | boolean | true | Flip and shift to stay inside the collision boundary. |
forceMount | true | none | Keep the content mounted while closed. |
Built on Radix Menubar Item; accepts all its props.
| Prop | Type | Default | Description |
|---|
variant | "default" | "destructive" | "default" | destructive colors the text, icon and highlight red. |
inset | boolean | none | Indents the item to line up with checkbox and radio items. |
disabled | boolean | none | Skips the item in keyboard navigation and blocks selection. |
onSelect | (event: Event) => void | none | Called when the item is chosen. event.preventDefault() keeps the menu open. |
textValue | string | none | Text used for typeahead when the content isn't plain text. |
Built on Radix Menubar CheckboxItem; accepts all its props. The check pops in only when checked changes, not when the menu opens.
| Prop | Type | Default | Description |
|---|
checked | boolean | "indeterminate" | none | Checked state. |
onCheckedChange | (checked: boolean) => void | none | Called when the item is toggled. |
disabled | boolean | none | Blocks toggling. |
onSelect | (event: Event) => void | none | Called when the item is chosen. event.preventDefault() keeps the menu open. |
Built on Radix Menubar RadioGroup; accepts all its props.
| Prop | Type | Default | Description |
|---|
value | string | none | Value of the selected item. |
onValueChange | (value: string) => void | none | Called when another item is selected. |
Built on Radix Menubar RadioItem; accepts all its props. The dot pops in only when the group's value changes to this item, not when the menu opens.
| Prop | Type | Default | Description |
|---|
value | string | none | Value of the item. Required. |
disabled | boolean | none | Blocks selection. |
Built on Radix Menubar Label; accepts all its props.
| Prop | Type | Default | Description |
|---|
inset | boolean | none | Indents the label to line up with checkbox and radio items. |
Built on Radix Menubar Separator, Group and Portal; each accepts all its props.
Renders a native <span> and accepts all of its props. Right-aligns a keyboard hint inside an item.
Built on Radix Menubar Sub; accepts all its props.
| Prop | Type | Default | Description |
|---|
open | boolean | none | Controlled open state of the sub-menu. |
defaultOpen | boolean | none | Initial open state when uncontrolled. |
onOpenChange | (open: boolean) => void | none | Called when the sub-menu opens or closes. |
Built on Radix Menubar SubTrigger; accepts all its props. Adds a chevron after its children.
| Prop | Type | Default | Description |
|---|
inset | boolean | none | Indents the trigger to line up with checkbox and radio items. |
disabled | boolean | none | Prevents the sub-menu from opening. |
Built on Radix Menubar SubContent; accepts all its props. Like MenubarContent, it ignores outside focus and presses while it animates out.
| Prop | Type | Default | Description |
|---|
sideOffset | number | 0 | Distance from the sub-trigger in px. |
alignOffset | number | 0 | Offset from the sub-trigger's top edge in px. |
loop | boolean | false | Wrap keyboard focus from the last item to the first. |
forceMount | true | none | Keep the content mounted while closed. |
Props match shadcn/ui Menubar.