Menubar
A horizontal application menu bar with keyboard navigation, submenus, checkbox and radio items. Built on Radix UI.
Overview
Menubar is a horizontal application menu bar — the kind you see in desktop apps (File, Edit, View, etc.). Built on Radix UI's Menubar primitive, it provides full keyboard navigation, nested submenus, checkbox/radio items, and shortcut hints.
Installation
Install the component via the CLI in one command.
npx @work-rjkashyap/unified-ui add menubarpnpm dlx @work-rjkashyap/unified-ui add menubarnpx @work-rjkashyap/unified-ui add menubarbunx @work-rjkashyap/unified-ui add menubarIf you haven't initialized your project yet, run npx @work-rjkashyap/unified-ui init first. See the CLI docs for details.
Or install the full package
Use this approach if you prefer to install the entire design system as a dependency instead of copying individual components.
npm install @work-rjkashyap/unified-uipnpm add @work-rjkashyap/unified-uiyarn add @work-rjkashyap/unified-uibun add @work-rjkashyap/unified-uiAnatomy
import {
Menubar,
MenubarMenu,
MenubarTrigger,
MenubarContent,
MenubarItem,
MenubarSeparator,
MenubarLabel,
MenubarShortcut,
MenubarSub,
MenubarSubTrigger,
MenubarSubContent,
MenubarCheckboxItem,
MenubarRadioGroup,
MenubarRadioItem,
MenubarGroup,
} from "@work-rjkashyap/unified-ui";Examples
Basic
With Submenus
Checkbox and Radio Items
Props
Menubar
| Prop | Type | Default | Description |
|---|---|---|---|
dir | "ltr" | "rtl" | — | Reading direction. |
loop | boolean | true | Whether keyboard focus loops between menus. |
className | string | — | Additional CSS classes on the root bar element. |
MenubarMenu
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | — | Unique value (needed for controlled open state). |
MenubarTrigger
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Additional CSS classes. |
disabled | boolean | false | Disables the trigger. |
MenubarItem
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "default" | "danger" | "default" | Visual style for destructive actions. |
icon | ReactNode | — | Icon rendered before the label. |
inset | boolean | false | Adds left padding to align without an icon. |
disabled | boolean | false | Disables the item. |
onSelect | (e: Event) => void | — | Callback fired when the item is selected. |
Accessibility
Menubar navigation follows the ARIA Authoring Practices Guide for menu bars.
Use the Menubar when you need desktop-app style navigation; for simpler site
navigation, prefer NavigationMenu.
- F6 / Tab — Moves focus to the menubar.
- Left / Right arrows — Move between top-level menu triggers.
- Enter / Space / Down arrow — Opens the focused menu.
- Up / Down arrows — Navigate within an open menu.
- Escape — Closes the open menu and returns focus to the trigger.
role="menubar",role="menu", androle="menuitem"are applied by Radix UI.