Menubar
A persistent row of menus, as in a desktop app.
When to use
- A desktop-style tool with many commands grouped by menu: an editor, a query console.
When not to use
- A few actions for one item: use Dropdown Menu.
- Site navigation: use Navigation Menu.
- Two or three frequent actions: show them as Buttons.
Install
npx shadcn@latest add @clinia/menubarClinia rules
- The highlighted item is
bg-foreground/4withtext-foreground, the same as Dropdown Menu. - Menu names are one word (
File,View). Items start with a verb or name the result:New record,Show archived. - Destructive items take
variant="destructive"and sit last, after a separator. MenubarShortcutis display text only. Show a shortcut only if you bind it.
Do and don't
Accessibility
Built in
- Arrow Left and Arrow Right move between menus in the bar. Enter, Space or Arrow Down opens a menu.
- Inside a menu, arrow keys move between items, Enter picks, and Escape closes it and returns focus to its trigger.
Your responsibility
- Bind every shortcut you show, and don't take over shortcuts the browser or screen reader relies on.
- Keep a disabled item only when the reason is visible, such as
Export (owner only).
How to test
- Press Tab to reach the menubar: focus lands on the first menu.
- Press Arrow Right: focus moves to the next menu. Press Enter: it opens on the first item.
- Press Escape: the menu closes and focus returns to its trigger.
- With a screen reader, the bar is announced as a menubar, and each item with its role and position.
API
MenubarLabel
| Prop | Values | Default | Description |
|---|---|---|---|
| inset | boolean | – | Indents the label to line up with items that have an icon or an indicator. |
MenubarItem
| Prop | Values | Default | Description |
|---|---|---|---|
| inset | boolean | – | Indents the item to line up with siblings that have an icon or an indicator. |
| variant | defaultdestructive | default |
|
MenubarCheckboxItem
| Prop | Values | Default | Description |
|---|---|---|---|
| inset | boolean | – | Indents the item to line up with siblings that have an icon or an indicator. |
MenubarRadioItem
| Prop | Values | Default | Description |
|---|---|---|---|
| inset | boolean | – | Indents the item to line up with siblings that have an icon or an indicator. |
MenubarSubTrigger
| Prop | Values | Default | Description |
|---|---|---|---|
| inset | boolean | – | Indents the item to line up with siblings that have an icon or an indicator. |
All other props come from Base UI Menubar.