---
title: "Menubar"
description: "A row of menus at the top of an app, such as File, Edit, and View. People open one and move to the next with the arrow keys."
url: https://gelatinui.com/components/menubar
markdown_url: https://gelatinui.com/components/menubar.md
access: free
install: "npx shadcn@latest add @gelatin-ui/menubar"
registry_item: https://gelatinui.com/r/menubar.json
version: "2026-11-08"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Menubar

> A row of menus at the top of an app, such as File, Edit, and View. People open one and move to the next with the arrow keys.

Page: https://gelatinui.com/components/menubar

## When to use it

Best for: A row of app menus (File, Edit, View) with items, toggles, and submenus.

- Use it in a desktop app with many commands, such as an editor.
- Put one `MenubarMenu` with a `MenubarTrigger` and `MenubarContent` per menu.
- Show shortcuts with `MenubarShortcut`; the menu does not bind the keys.

## When not to use it

- For one menu behind a button, use a [Menu](https://gelatinui.com/components/menu.md).
- For site links, use a [Navigation Menu](https://gelatinui.com/components/navigation-menu.md).

## Notes for agents

- The bar is one Tab stop; the arrow keys move between the triggers.
- `modal` (default true) locks the page scroll while a menu is open.
- Give a shortcut item a `label`, so typing a letter matches the name.

## Anatomy

```text
Menubar
├─ MenubarTrigger (0..n)
├─ MenubarPortal (0..n)
└─ MenubarContent (0..n)
```

## API reference

### Menubar

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

Also takes every prop of Base UI `Menubar`: https://base-ui.com/react/components/menubar

### MenubarTrigger

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

Also takes every prop of Base UI `Menu.Trigger`: https://base-ui.com/react/components/menu

### MenubarPortal

Also takes every prop of Base UI `Menu.Portal`: https://base-ui.com/react/components/menu

### MenubarContent

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `arrow` | `boolean` | false | Show an arrow that points at the trigger. The gap grows from 4px to 8px. |
| `backdrop` | `boolean` |  | Put a clear layer under the popup (Base UI `Menu.Backdrop`), for example to dim it. |
| `portalProps` | `Omit` |  | Other Base UI props of the inner parts. A `className` here adds to the component classes. |
| `positionerProps` | `PopupPartProps` |  |  |
| `backdropProps` | `PopupPartProps<MenuBackdropProps>` |  |  |
| `arrowProps` | `PopupPartProps<MenuArrowProps>` |  |  |

Also takes every prop of Base UI `Menu.Popup`: https://base-ui.com/react/components/menu

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| Menubar | `menubar` |  |  |  |
| MenubarTrigger | `menubar-trigger` | `data-orientation` |  |  |
| MenubarPortal | `menubar-portal` |  |  |  |
| MenubarContent | `menubar-content` |  |  |  |

## Usage

Put one menu for each word in the bar. Each menu has a trigger and its content with items.

```tsx title="editor-menubar.tsx"
import {
  Menubar,
  MenubarCheckboxItem,
  MenubarContent,
  MenubarItem,
  MenubarMenu,
  MenubarSeparator,
  MenubarShortcut,
  MenubarTrigger,
} from "@/components/ui/menubar";

export function EditorMenubar() {
  return (
    <Menubar aria-label="Editor">
      <MenubarMenu>
        <MenubarTrigger>File</MenubarTrigger>
        <MenubarContent>
          <MenubarItem>
            New note <MenubarShortcut>⌘N</MenubarShortcut>
          </MenubarItem>
          <MenubarItem>
            Save <MenubarShortcut>⌘S</MenubarShortcut>
          </MenubarItem>
          <MenubarSeparator />
          <MenubarItem>Export as PDF</MenubarItem>
        </MenubarContent>
      </MenubarMenu>
      <MenubarMenu>
        <MenubarTrigger>View</MenubarTrigger>
        <MenubarContent>
          <MenubarCheckboxItem defaultChecked>Ruler</MenubarCheckboxItem>
          <MenubarCheckboxItem>Word count</MenubarCheckboxItem>
        </MenubarContent>
      </MenubarMenu>
    </Menubar>
  );
}
```

## Compose

Rules:

- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui/menubar
```

It adds 25 registry items: 22 files, 3972 lines, and the npm packages `@base-ui/react`, `@phosphor-icons/react`, `clsx`, `tailwind-merge`, `tailwind-variants`.

## Built on

- [Button](https://gelatinui.com/components/button.md)
- [Menu](https://gelatinui.com/components/menu.md)

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Menu](https://gelatinui.com/components/menu.md)
- [Context Menu](https://gelatinui.com/components/context-menu.md)
- [Navigation Menu](https://gelatinui.com/components/navigation-menu.md)

## Keyboard

| Keys | Action |
| --- | --- |
| ← → | Moves between the triggers. With a menu open, opens the next menu. |
| Enter, Space, ↓ | Opens the menu of the focused trigger. |
| Home, End | Moves to the first or the last trigger. |
| Escape | Closes the menu. Focus returns to its trigger. |

## Accessibility

It is a Base UI Menubar: the bar has the `menubar` role, and each menu is a `menu`.

A disabled trigger fades, and the arrow keys skip it.
