Installation
$ pnpm dlx shadcn@latest add @synccn/menubarFirst time in this project? Connect synccn with one command.
Usage
import { Menubar } from "@/components/ui/menubar";<Menubar menus={menus} />API reference
Generated from the component's TypeScript types, so it always matches the code.
Menubar
Desktop-app style menu bar. Once one menu is open, hovering the others switches between them; Left/Right arrows move along the bar. menus: [{ label, items: [...same item shape as DropdownMenu] }]
PropTypeDescription
- menusrequired
MenubarMenu[]Top-level menus, left to right.
- className
stringExtra classes for the root element.
Dependencies
Read from the component's imports when the site builds. The CLI installs all of these for you.
Helpers
npm packages
- clsx for cn()
- tailwind-merge for cn()
- lucide-react for Check
Keyboard
- ←or→Move between top-level menus
- ↓Open the focused menu
- EscClose the open menu
Accessibility
- Uses menubar, menu and menuitem roles; triggers report aria-expanded and aria-haspopup.
From the source
Read from this component's code when the site builds, so it can't drift.
- ARIA roles: it, menu, menubar, menuitem
- ARIA attributes: aria-checked, aria-expanded, aria-haspopup
- Keys handled: ArrowDown, ArrowLeft, ArrowRight
- Closes with Escape
- Closes when you click or tap outside
- Shows a visible focus ring for keyboard users
More overlays
DialogModal with focus trap, scroll lock and Escape to close.SheetPanel that slides in from the left, right or bottom.Dropdown MenuActions, checkboxes, labels and shortcuts with arrow-key navigation.Context MenuRight-click menu that also opens on long-press.PopoverFloating panel anchored to a trigger.TooltipLabel on hover and focus, on any side.