About the shadcn/ui Menubar Component

The Menubar component is part of shadcn/ui — a collection of accessible, copy-paste React components built with Radix UI and Tailwind CSS. Install it with `npx shadcn@latest add menubar` and copy it directly into your project.

Menubar Component — Frequently Asked Questions

How do I add keyboard shortcuts to a shadcn Menubar item?

Add `<MenubarShortcut>⌘S</MenubarShortcut>` inside `<MenubarItem>`. Use `useEffect` with a `keydown` listener to handle the actual keyboard shortcut behavior.

How do I nest submenus in shadcn Menubar?

Use `<MenubarSub>` wrapping `<MenubarSubTrigger>` and `<MenubarSubContent>`. This creates a flyout submenu from any menu item.

How do I add checkboxes to a shadcn Menubar?

Use `<MenubarCheckboxItem checked={checked} onCheckedChange={setChecked}>`. For radio-style exclusivity, use `<MenubarRadioGroup>` with `<MenubarRadioItem>`.

Menubar Component - shadcn/ui Examples | Shadcn Store