# Menubar
A row of application menus, run by a person or an agent.
Source page: https://dinachi.dev/docs/components/menubar

## Installation
```bash
npx @dinachi/cli@latest add menubar
```
Adds to your project:
- `components/ui/menubar/menubar.tsx`
- `components/ui/menubar/index.ts`
Installs:
- `@base-ui/react` ^1.9.0
- `lucide-react` ^0.552.0

## Usage
```tsx
import {
  Menubar,
  MenubarContent,
  MenubarItem,
  MenubarMenu,
  MenubarPortal,
  MenubarPositioner,
  MenubarTrigger,
} from "@/components/ui/menubar"

export function AppMenubar() {
  return (
    <Menubar aria-label="Editor">
      <MenubarMenu>
        <MenubarTrigger>File</MenubarTrigger>
        <MenubarPortal>
          <MenubarPositioner>
            <MenubarContent>
              <MenubarItem onClick={() => newFile()}>New file</MenubarItem>
              <MenubarItem onClick={() => save()}>Save</MenubarItem>
            </MenubarContent>
          </MenubarPositioner>
        </MenubarPortal>
      </MenubarMenu>
    </Menubar>
  )
}
```

## Anatomy
```tsx
<Menubar>
  <MenubarMenu>
    <MenubarTrigger />
    <MenubarPortal>
      <MenubarPositioner>
        <MenubarContent>
          <MenubarGroup>
            <MenubarLabel />
            <MenubarItem>
              <MenubarShortcut />
            </MenubarItem>
          </MenubarGroup>
          <MenubarSeparator />
          <MenubarCheckboxItem />
          <MenubarRadioGroup>
            <MenubarRadioItem />
          </MenubarRadioGroup>
          <MenubarSub>
            <MenubarSubTrigger />
            <MenubarSubContent />
          </MenubarSub>
        </MenubarContent>
      </MenubarPositioner>
    </MenubarPortal>
  </MenubarMenu>
</Menubar>
```
- `Menubar`: Holds the menus and moves focus between them.
- `MenubarMenu`: One menu. Holds its open state.
- `MenubarTrigger`: The button that opens its menu.
- `MenubarPortal`: Renders the popup into the body.
- `MenubarPositioner`: Places the popup against its trigger.
- `MenubarContent`: The popup, without portal or positioner.
- `MenubarItem`: One action.
- `MenubarCheckboxItem`: A toggle item, checked when on.
- `MenubarRadioGroup`: Holds the value of its radio items.
- `MenubarRadioItem`: One radio choice, dotted when chosen.
- `MenubarGroup`: Groups items under a `MenubarLabel`.
- `MenubarLabel`: The heading of a group.
- `MenubarSeparator`: A line between items or groups.
- `MenubarShortcut`: A keyboard hint. Display only; binds no key.
- `MenubarSub`: Holds a nested menu.
- `MenubarSubTrigger`: Opens a submenu; shows a chevron.
- `MenubarSubContent`: Submenu popup with its own portal and positioner.

## Examples

### Default
File, Edit and View menus.
```tsx
import {
  Menubar,
  MenubarMenu,
  MenubarTrigger,
  MenubarPortal,
  MenubarPositioner,
  MenubarContent,
  MenubarItem,
  MenubarSeparator,
  MenubarShortcut,
} from '@/components/ui/menubar';

export function Example() {
  return (
    <Menubar>
      <MenubarMenu>
        <MenubarTrigger>File</MenubarTrigger>
        <MenubarPortal>
          <MenubarPositioner>
            <MenubarContent>
              <MenubarItem>New Tab <MenubarShortcut>⌘T</MenubarShortcut></MenubarItem>
              <MenubarItem>New Window <MenubarShortcut>⌘N</MenubarShortcut></MenubarItem>
              <MenubarSeparator />
              <MenubarItem>Print <MenubarShortcut>⌘P</MenubarShortcut></MenubarItem>
            </MenubarContent>
          </MenubarPositioner>
        </MenubarPortal>
      </MenubarMenu>
      <MenubarMenu>
        <MenubarTrigger>Edit</MenubarTrigger>
        <MenubarPortal>
          <MenubarPositioner>
            <MenubarContent>
              <MenubarItem>Undo <MenubarShortcut>⌘Z</MenubarShortcut></MenubarItem>
              <MenubarItem>Redo <MenubarShortcut>⌘⇧Z</MenubarShortcut></MenubarItem>
              <MenubarSeparator />
              <MenubarItem>Cut <MenubarShortcut>⌘X</MenubarShortcut></MenubarItem>
              <MenubarItem>Copy <MenubarShortcut>⌘C</MenubarShortcut></MenubarItem>
              <MenubarItem>Paste <MenubarShortcut>⌘V</MenubarShortcut></MenubarItem>
            </MenubarContent>
          </MenubarPositioner>
        </MenubarPortal>
      </MenubarMenu>
      <MenubarMenu>
        <MenubarTrigger>View</MenubarTrigger>
        <MenubarPortal>
          <MenubarPositioner>
            <MenubarContent>
              <MenubarItem>Zoom In <MenubarShortcut>⌘+</MenubarShortcut></MenubarItem>
              <MenubarItem>Zoom Out <MenubarShortcut>⌘-</MenubarShortcut></MenubarItem>
              <MenubarSeparator />
              <MenubarItem>Toggle Fullscreen</MenubarItem>
            </MenubarContent>
          </MenubarPositioner>
        </MenubarPortal>
      </MenubarMenu>
    </Menubar>
  );
}
```

### Checkbox items
Items that toggle on and off.
```tsx
import React from 'react';
import {
  Menubar,
  MenubarMenu,
  MenubarTrigger,
  MenubarPortal,
  MenubarPositioner,
  MenubarContent,
  MenubarItem,
  MenubarSeparator,
  MenubarCheckboxItem,
  MenubarGroup,
  MenubarLabel,
} from '@/components/ui/menubar';

export function Example() {
  const [showToolbar, setShowToolbar] = React.useState(true);
  const [showSidebar, setShowSidebar] = React.useState(false);

  return (
    <Menubar>
      <MenubarMenu>
        <MenubarTrigger>View</MenubarTrigger>
        <MenubarPortal>
          <MenubarPositioner>
            <MenubarContent>
              <MenubarGroup>
                <MenubarLabel>Panels</MenubarLabel>
                <MenubarSeparator />
                <MenubarCheckboxItem checked={showToolbar} onCheckedChange={setShowToolbar}>
                  Show Toolbar
                </MenubarCheckboxItem>
                <MenubarCheckboxItem checked={showSidebar} onCheckedChange={setShowSidebar}>
                  Show Sidebar
                </MenubarCheckboxItem>
              </MenubarGroup>
              <MenubarSeparator />
              <MenubarItem>Toggle Fullscreen</MenubarItem>
            </MenubarContent>
          </MenubarPositioner>
        </MenubarPortal>
      </MenubarMenu>
    </Menubar>
  );
}
```

### Submenu
A nested menu of recent files.
```tsx
import {
  Menubar,
  MenubarMenu,
  MenubarTrigger,
  MenubarPortal,
  MenubarPositioner,
  MenubarContent,
  MenubarItem,
  MenubarSeparator,
  MenubarSub,
  MenubarSubTrigger,
  MenubarSubContent,
} from '@/components/ui/menubar';

export function Example() {
  return (
    <Menubar>
      <MenubarMenu>
        <MenubarTrigger>File</MenubarTrigger>
        <MenubarPortal>
          <MenubarPositioner>
            <MenubarContent>
              <MenubarItem>New File</MenubarItem>
              <MenubarSub>
                <MenubarSubTrigger>Open Recent</MenubarSubTrigger>
                <MenubarSubContent>
                  <MenubarItem>project-a.ts</MenubarItem>
                  <MenubarItem>readme.md</MenubarItem>
                  <MenubarItem>config.json</MenubarItem>
                </MenubarSubContent>
              </MenubarSub>
              <MenubarSeparator />
              <MenubarItem>Save All</MenubarItem>
            </MenubarContent>
          </MenubarPositioner>
        </MenubarPortal>
      </MenubarMenu>
    </Menubar>
  );
}
```

## Notes

### Composing the popup
Wrap `MenubarContent` in `MenubarPortal` and `MenubarPositioner`, as in the usage above. `MenubarSubContent` brings its own.

## API reference
Props marked **agent** change what an agent reads or may do.

### Menubar
Holds the menus and moves focus between them.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `modal` | `boolean` | `true` | Locks page scroll and outside clicks while a menu is open. |
| `loopFocus` | `boolean` | `true` | Wraps focus from the last trigger to the first. |
| `disabled` | `boolean` | `false` | Disables every menu in the bar. |
| `orientation` | `"horizontal" \| "vertical"` | `"horizontal"` | Which arrow keys move between menus. |
| `aria-label` **agent** | `string` | - | Names the bar. The agent reports it as `in` on each menu. |

### MenubarMenu
One menu. Holds its open state.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `open` | `boolean` | - | Controlled open state. |
| `defaultOpen` | `boolean` | `false` | Starting open state when uncontrolled. |
| `onOpenChange` **agent** | `(open, details) => void` | - | Runs on open or close, for people and agents. `details.cancel()` refuses. |
| `disabled` | `boolean` | `false` | Ignores interaction. |

### MenubarTrigger
The button that opens its menu.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children` **agent** | `ReactNode` | - | The label. Also the name the agent reads. |
| `disabled` | `boolean` | `false` | Blocks the trigger. |

### MenubarPortal
Renders the popup into the body.

Takes the props of the element it renders.

### MenubarPositioner
Places the popup against its trigger.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `side` | `"top" \| "bottom" \| "left" \| "right" \| "inline-start" \| "inline-end"` | `"bottom"` | Which side of the trigger the popup goes on. |
| `align` | `"start" \| "center" \| "end"` | `"start"` | Alignment along that side. |
| `sideOffset` | `number` | `4` | Gap to the trigger, in pixels. |

### MenubarContent
The popup, without portal or positioner.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` | - | Merged with the popup styles. |

### MenubarItem
One action.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `onClick` **agent** | `(event) => void` | - | Runs the action. An agent's press triggers it too. |
| `closeOnClick` | `boolean` | `true` | Closes the menu once clicked. |
| `disabled` **agent** | `boolean` | `false` | Skipped by the keyboard, refused for agents. |
| `inset` | `boolean` | `false` | Indents the item to line up with checkbox and radio items. |

### MenubarCheckboxItem
A toggle item, checked when on.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `checked` **agent** | `boolean` | - | Controlled checked state. |
| `defaultChecked` | `boolean` | `false` | Starting state when uncontrolled. |
| `onCheckedChange` | `(checked, details) => void` | - | Runs when it toggles. |
| `closeOnClick` | `boolean` | `false` | Closes the menu once clicked. |
| `disabled` **agent** | `boolean` | `false` | Skipped by the keyboard, refused for agents. |

### MenubarRadioGroup
Holds the value of its radio items.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `value` | `any` | - | Controlled value. |
| `defaultValue` | `any` | - | Starting value when uncontrolled. |
| `onValueChange` | `(value, details) => void` | - | Runs when another radio item is chosen. |

### MenubarRadioItem
One radio choice, dotted when chosen.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `value` | `any` | - | What the group's `onValueChange` receives. |
| `disabled` **agent** | `boolean` | `false` | Skipped by the keyboard, refused for agents. |

### MenubarGroup
Groups items under a `MenubarLabel`.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children` | `ReactNode` | - | A `MenubarLabel`, then items. |

### MenubarLabel
The heading of a group.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `inset` | `boolean` | `false` | Indents it to line up with inset items. |

### MenubarSeparator
A line between items or groups.

Takes the props of the element it renders.

### MenubarShortcut
A keyboard hint. Display only; binds no key.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children` | `ReactNode` | - | The shortcut text, such as `⌘S`. |

### MenubarSub
Holds a nested menu.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `open` | `boolean` | - | Controlled open state. |
| `onOpenChange` | `(open, details) => void` | - | Runs when the submenu opens or closes. |

### MenubarSubTrigger
Opens a submenu; shows a chevron.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `openOnHover` | `boolean` | `true` | Opens the submenu on hover. |
| `inset` | `boolean` | `false` | Indents it to line up with inset items. |

### MenubarSubContent
Submenu popup with its own portal and positioner.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` | - | Merged with the popup styles. |

## Agent
Inside an `AgentProvider`, Menubar appears in `agent.snapshot()` as `menu`.
Reads:
- `label`: The trigger's text.
- `open`: Whether that menu's popup is showing.
- `in`: The menubar's aria-label, when it has one.
Actions:
- `open() / close()`: Whichever fits the current state. The menu stays listed at its trigger.
- `press() on an item`: Items in the open menu are listed as `menuitem`. Press runs it as a click.
- `setChecked(true) on a checkbox item`: Toggles it. A radio item takes only press.
Open and close run through `MenubarMenu`'s `onOpenChange`. `isAgentChange(details)` is true for an agent's change; `details.cancel()` refuses it and the agent is told. An item press is an ordinary click to `onClick` and `onCheckedChange`. Disabled items refuse on their own.
```ts
await agent.act({
  steps: [
    { ref: "File", action: "open" },
    { ref: "New Tab", action: "press" },
  ],
})
```

## Accessibility
- The bar has the menubar role; triggers open menus; items expose checked state.
- Name the bar with aria-label when a page has more than one.
- Disabled items stay announced but are skipped by the keyboard.
- Reduced motion drops the popup's scale and keeps the fade.
### Keyboard
| Keys | Does |
| --- | --- |
| `←` / `→` | Moves between menus in the bar |
| `Enter` / `Space` / `↓` | Opens the focused menu |
| `↑` / `↓` | Moves the highlight inside an open menu |
| `→` | Opens the highlighted submenu |
| `Esc` | Closes the menu and returns focus to its trigger |

## Source
`components/ui/menubar/menubar.tsx`
```tsx
"use client"

import * as React from "react"
import { Menubar as BaseMenubar } from "@base-ui/react/menubar"
import { Menu } from "@base-ui/react/menu"
import { cn } from "@/lib/utils"
import { Check, ChevronRight, Circle } from "lucide-react"
import { useAgentOpen, useHasAgent, useMergedRef } from "@/components/ui/agent"

const Menubar = React.forwardRef<
  React.ComponentRef<typeof BaseMenubar>,
  React.ComponentProps<typeof BaseMenubar>
>(({ className, ...props }, ref) => (
  <BaseMenubar
    ref={ref}
    className={cn(
      "flex h-10 items-center space-x-1 rounded-md border bg-background p-1",
      className
    )}
    data-slot="menubar"
    {...props}
  />
))
Menubar.displayName = "Menubar"

const MenubarAgentContext = React.createContext<React.RefCallback<HTMLElement> | null>(null)

/**
 * Base UI's menu, holding its own open state so an agent can open and close it. The agent
 * sees it as its trigger, open or closed, so it stays in the menubar; its items are in the
 * trigger's menu.
 */
const MenubarMenu: React.FC<React.ComponentProps<typeof Menu.Root>> = ({
  open,
  defaultOpen,
  onOpenChange,
  ...props
}) => {
  const [state, change, parts] = useAgentOpen("menu", open, defaultOpen, onOpenChange)
  return (
    <MenubarAgentContext.Provider value={useHasAgent() ? parts.trigger : null}>
      <Menu.Root {...props} open={state} onOpenChange={change} />
    </MenubarAgentContext.Provider>
  )
}
MenubarMenu.displayName = "MenubarMenu"

const MenubarTrigger = React.forwardRef<
  HTMLButtonElement,
  React.ComponentProps<typeof Menu.Trigger>
>(({ className, ...props }, ref) => (
  <Menu.Trigger
    ref={useMergedRef(ref, React.useContext(MenubarAgentContext))}
    className={cn(
      "flex cursor-default select-none items-center rounded-sm px-3 py-1.5 text-sm font-medium outline-none",
      "focus:bg-accent focus:text-accent-foreground",
      "data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",
      "data-[popup-open]:bg-accent data-[popup-open]:text-accent-foreground",
      "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
      className
    )}
    data-slot="menubar-trigger"
    {...props}
  />
))
MenubarTrigger.displayName = "MenubarTrigger"

const MenubarPortal: React.FC<
  React.ComponentProps<typeof Menu.Portal>
> = (props) => <Menu.Portal data-slot="menubar-portal" {...props} />
MenubarPortal.displayName = "MenubarPortal"

const MenubarPositioner = React.forwardRef<
  React.ComponentRef<typeof Menu.Positioner>,
  React.ComponentProps<typeof Menu.Positioner>
>(({ className, ...props }, ref) => (
  <Menu.Positioner
    ref={ref}
    className={cn("z-50 outline-none", className)}
    sideOffset={4}
    data-slot="menubar-positioner"
    {...props}
  />
))
MenubarPositioner.displayName = "MenubarPositioner"

const MenubarContent = React.forwardRef<
  React.ComponentRef<typeof Menu.Popup>,
  React.ComponentProps<typeof Menu.Popup>
>(({ className, ...props }, ref) => (
  <Menu.Popup
    ref={ref}
    className={cn(
      "min-w-48 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
      "origin-[var(--transform-origin)]",
      "outline-none focus:outline-none focus-visible:outline-none",
      "transition-[transform,scale,opacity] duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
      "data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
      "data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
      "motion-reduce:data-[starting-style]:scale-100 motion-reduce:data-[ending-style]:scale-100",
      className
    )}
    data-slot="menubar-content"
    {...props}
  />
))
MenubarContent.displayName = "MenubarContent"

const MenubarItem = React.forwardRef<
  React.ComponentRef<typeof Menu.Item>,
  React.ComponentProps<typeof Menu.Item> & {
    inset?: boolean
  }
>(({ className, inset, ...props }, ref) => (
  <Menu.Item
    ref={ref}
    className={cn(
      "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",
      "focus:bg-accent focus:text-accent-foreground",
      "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
      "data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",
      inset && "pl-8",
      className
    )}
    data-slot="menubar-item"
    {...props}
  />
))
MenubarItem.displayName = "MenubarItem"

const MenubarCheckboxItem = React.forwardRef<
  React.ComponentRef<typeof Menu.CheckboxItem>,
  React.ComponentProps<typeof Menu.CheckboxItem>
>(({ className, children, ...props }, ref) => (
  <Menu.CheckboxItem
    ref={ref}
    className={cn(
      "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none",
      "focus:bg-accent focus:text-accent-foreground",
      "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
      "data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",
      className
    )}
    data-slot="menubar-checkbox-item"
    {...props}
  >
    <Menu.CheckboxItemIndicator className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
      <Check className="h-4 w-4" />
    </Menu.CheckboxItemIndicator>
    {children}
  </Menu.CheckboxItem>
))
MenubarCheckboxItem.displayName = "MenubarCheckboxItem"

const MenubarRadioGroup = React.forwardRef<
  React.ComponentRef<typeof Menu.RadioGroup>,
  React.ComponentProps<typeof Menu.RadioGroup>
>(({ className, ...props }, ref) => (
  <Menu.RadioGroup ref={ref} className={className} data-slot="menubar-radio-group" {...props} />
))
MenubarRadioGroup.displayName = "MenubarRadioGroup"

const MenubarRadioItem = React.forwardRef<
  React.ComponentRef<typeof Menu.RadioItem>,
  React.ComponentProps<typeof Menu.RadioItem>
>(({ className, children, ...props }, ref) => (
  <Menu.RadioItem
    ref={ref}
    className={cn(
      "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none",
      "focus:bg-accent focus:text-accent-foreground",
      "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
      "data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",
      className
    )}
    data-slot="menubar-radio-item"
    {...props}
  >
    <Menu.RadioItemIndicator className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
      <Circle className="h-2 w-2 fill-current" />
    </Menu.RadioItemIndicator>
    {children}
  </Menu.RadioItem>
))
MenubarRadioItem.displayName = "MenubarRadioItem"

const MenubarGroup = React.forwardRef<
  React.ComponentRef<typeof Menu.Group>,
  React.ComponentProps<typeof Menu.Group>
>(({ className, ...props }, ref) => (
  <Menu.Group ref={ref} className={className} data-slot="menubar-group" {...props} />
))
MenubarGroup.displayName = "MenubarGroup"

const MenubarLabel = React.forwardRef<
  React.ComponentRef<typeof Menu.GroupLabel>,
  React.ComponentProps<typeof Menu.GroupLabel> & {
    inset?: boolean
  }
>(({ className, inset, ...props }, ref) => (
  <Menu.GroupLabel
    ref={ref}
    className={cn(
      "px-2 py-1.5 text-sm font-medium text-foreground",
      inset && "pl-8",
      className
    )}
    data-slot="menubar-label"
    {...props}
  />
))
MenubarLabel.displayName = "MenubarLabel"

const MenubarSeparator = React.forwardRef<
  React.ComponentRef<typeof Menu.Separator>,
  React.ComponentProps<typeof Menu.Separator>
>(({ className, ...props }, ref) => (
  <Menu.Separator
    ref={ref}
    className={cn("-mx-1 my-1 h-px bg-border", className)}
    data-slot="menubar-separator"
    {...props}
  />
))
MenubarSeparator.displayName = "MenubarSeparator"

const MenubarShortcut = ({
  className,
  ...props
}: React.HTMLAttributes<HTMLSpanElement>) => (
  <span
    className={cn(
      "ml-auto text-xs tracking-widest text-muted-foreground",
      className
    )}
    data-slot="menubar-shortcut"
    {...props}
  />
)
MenubarShortcut.displayName = "MenubarShortcut"

const MenubarSub: React.FC<React.ComponentProps<typeof Menu.SubmenuRoot>> = (props) => (
  <Menu.SubmenuRoot {...props} />
)
MenubarSub.displayName = "MenubarSub"

const MenubarSubTrigger = React.forwardRef<
  React.ComponentRef<typeof Menu.SubmenuTrigger>,
  React.ComponentProps<typeof Menu.SubmenuTrigger> & {
    inset?: boolean
  }
>(({ className, inset, children, ...props }, ref) => (
  <Menu.SubmenuTrigger
    ref={ref}
    className={cn(
      "flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",
      "focus:bg-accent focus:text-accent-foreground",
      "data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",
      "data-[popup-open]:bg-accent data-[popup-open]:text-accent-foreground",
      "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
      inset && "pl-8",
      className
    )}
    data-slot="menubar-sub-trigger"
    {...props}
  >
    {children}
    <ChevronRight className="ml-auto h-4 w-4" />
  </Menu.SubmenuTrigger>
))
MenubarSubTrigger.displayName = "MenubarSubTrigger"

const MenubarSubContent = React.forwardRef<
  React.ComponentRef<typeof Menu.Popup>,
  React.ComponentProps<typeof Menu.Popup>
>(({ className, ...props }, ref) => (
  <Menu.Portal>
    <Menu.Positioner className="z-50 outline-none" alignOffset={-4} sideOffset={8}>
      <Menu.Popup
        ref={ref}
        className={cn(
          "min-w-32 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg",
          "origin-[var(--transform-origin)]",
          "outline-none focus:outline-none focus-visible:outline-none",
          "transition-[transform,scale,opacity] duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
          "data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
          "data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
          "motion-reduce:data-[starting-style]:scale-100 motion-reduce:data-[ending-style]:scale-100",
          className
        )}
        data-slot="menubar-sub-content"
        {...props}
      />
    </Menu.Positioner>
  </Menu.Portal>
))
MenubarSubContent.displayName = "MenubarSubContent"

export {
  Menubar,
  MenubarMenu,
  MenubarTrigger,
  MenubarPortal,
  MenubarPositioner,
  MenubarContent,
  MenubarItem,
  MenubarCheckboxItem,
  MenubarRadioGroup,
  MenubarRadioItem,
  MenubarGroup,
  MenubarLabel,
  MenubarSeparator,
  MenubarShortcut,
  MenubarSub,
  MenubarSubTrigger,
  MenubarSubContent,
}
```
