A horizontal menu with clickable items, groups, and dropdown menus for applications.
import {
Menubar,
MenubarContent,
MenubarItem,
MenubarMenu,
MenubarSeparator,
MenubarShortcut,
MenubarTrigger,
} from "@/components/ui/menubar"
export function MenubarDemo() {
return (
<Menubar>
<MenubarMenu>
<MenubarTrigger>File</MenubarTrigger>
<MenubarContent>
<MenubarItem>
New Tab <MenubarShortcut>⌘T</MenubarShortcut>
</MenubarItem>
<MenubarItem>
New Window <MenubarShortcut>⌘N</MenubarShortcut>
</MenubarItem>
<MenubarSeparator />
<MenubarItem>
Print... <MenubarShortcut>⌘P</MenubarShortcut>
</MenubarItem>
</MenubarContent>
</MenubarMenu>
<MenubarMenu>
<MenubarTrigger>Edit</MenubarTrigger>
<MenubarContent>
<MenubarItem>
Undo <MenubarShortcut>⌘Z</MenubarShortcut>
</MenubarItem>
<MenubarItem>
Redo <MenubarShortcut>⇧⌘Z</MenubarShortcut>
</MenubarItem>
<MenubarSeparator />
<MenubarItem>
Cut <MenubarShortcut>⌘X</MenubarShortcut>
</MenubarItem>
<MenubarItem>
Copy <MenubarShortcut>⌘C</MenubarShortcut>
</MenubarItem>
<MenubarItem>
Paste <MenubarShortcut>⌘V</MenubarShortcut>
</MenubarItem>
</MenubarContent>
</MenubarMenu>
</Menubar>
)
}| Prop | Type | Default | Description |
|---|---|---|---|
| defaultValue | string | - | The value of the menu that should be open when initially rendered. |
| value | string | - | The controlled value of the menu to open. |
| onValueChange | function | - | Event handler called when the value changes. |
| loop | boolean | true | When true, keyboard navigation will loop from last item to first, and vice versa. |