# Menubar

> A desktop-style menu bar: File, Edit, View…

- Category: [Navigation](https://tarve.dev/docs.md#navigation)
- Import: `import { Menubar } from "@tarve/core";`
- Props type: `MenubarProps`
- Source: [packages/core/src/extra-controls.ts:995](https://github.com/omarcosr/tarve/blob/main/packages/core/src/extra-controls.ts#L995)

## Usage

```tsx title="Menubar.tsx"
import { Menubar } from "@tarve/core";

let openMenu: string | undefined = "file";

<Menubar
  openMenu={openMenu}
  menus={[
    {
      value: "file",
      label: "File",
      items: [
        { value: "new", label: "New", shortcut: "Ctrl+N" },
        { value: "open", label: "Open…", shortcut: "Ctrl+O" },
      ],
    },
    { value: "edit", label: "Edit", items: [{ value: "undo", label: "Undo", shortcut: "Ctrl+Z" }] },
  ]}
  onOpenMenuChange={(value) => {
    openMenu = value;
  }}
  onSelect={(menu, item) => console.log(menu, item)}
/>
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `menus` (required) | `MenubarMenu[]` | — |  |
| `onOpenMenuChange` | `(value: string \| undefined) => void` | — |  |
| `onSelect` | `(menuValue: string, itemValue: string) => void` | — |  |
| `openMenu` | `string` | — |  |

## Common props

Shared by every component (descriptions: https://tarve.dev/docs.md#common-props): `children`, `class`, `className`, `highlight`, `id`, `key`, `motionFrom`, `onHighlight`, `onPaste`, `onPointerLeave`, `onPointerMove`, `onSize`, `onTransitionEnd`, `rovingGroup`, `style`.

## Types

```ts title="MenubarMenu"
interface MenubarMenu {
  value: string;
  label: string;
  disabled?: boolean;
  items: MenubarItem[];
}
```

Previous: [NavigationMenu](https://tarve.dev/docs/components/NavigationMenu.md) · Next: [AppMenuBar](https://tarve.dev/docs/components/AppMenuBar.md)

---

Tarve v0.13.8 · HTML version: https://tarve.dev/docs/components/Menubar · Index for agents: https://tarve.dev/llms.txt
