apps/v4/content/docs/components/base/menubar.mdx
npx shadcn@latest add menubar
<Step>Install the following dependencies:</Step>
npm install @base-ui/react
<Step>Copy and paste the following code into your project.</Step>
<ComponentSource name="menubar" title="components/ui/menubar.tsx" styleName="base-nova" />
<Step>Update the import paths to match your project setup.</Step>
</Steps> </TabsContent> </CodeTabs>import {
Menubar,
MenubarContent,
MenubarGroup,
MenubarItem,
MenubarMenu,
MenubarSeparator,
MenubarShortcut,
MenubarTrigger,
} from "@/components/ui/menubar"
<Menubar>
<MenubarMenu>
<MenubarTrigger>File</MenubarTrigger>
<MenubarContent>
<MenubarGroup>
<MenubarItem>
New Tab <MenubarShortcut>⌘T</MenubarShortcut>
</MenubarItem>
<MenubarItem>New Window</MenubarItem>
</MenubarGroup>
<MenubarSeparator />
<MenubarGroup>
<MenubarItem>Share</MenubarItem>
<MenubarItem>Print</MenubarItem>
</MenubarGroup>
</MenubarContent>
</MenubarMenu>
</Menubar>
Use MenubarCheckboxItem for toggleable options.
Use MenubarRadioGroup and MenubarRadioItem for single-select options.
Use MenubarSub, MenubarSubTrigger, and MenubarSubContent for nested menus.
To enable RTL support in shadcn/ui, see the RTL configuration guide.
<ComponentPreview styleName="base-nova" name="menubar-rtl" direction="rtl" />See the Base UI Menubar documentation.