# Menubar

A horizontal row of menus, like the menu bar of a desktop application.

```tsx
import { Menubar, MenubarContent, MenubarItem, MenubarMenu, MenubarSeparator, MenubarShortcut, MenubarTrigger } from "@zenoxai/ui/components/menubar"

function MenubarDemo() {
  return (
    <Menubar>
      <MenubarMenu>
        <MenubarTrigger>Report</MenubarTrigger>
        <MenubarContent>
          <MenubarItem>
            New report <MenubarShortcut>⌘N</MenubarShortcut>
          </MenubarItem>
          <MenubarItem>
            Duplicate <MenubarShortcut>⌘D</MenubarShortcut>
          </MenubarItem>
          <MenubarSeparator />
          <MenubarItem>
            Export PDF <MenubarShortcut>⌘E</MenubarShortcut>
          </MenubarItem>
          <MenubarItem>Schedule delivery</MenubarItem>
        </MenubarContent>
      </MenubarMenu>
      <MenubarMenu>
        <MenubarTrigger>Edit</MenubarTrigger>
        <MenubarContent>
          <MenubarItem>
            Undo <MenubarShortcut>⌘Z</MenubarShortcut>
          </MenubarItem>
          <MenubarItem>
            Redo <MenubarShortcut>⇧⌘Z</MenubarShortcut>
          </MenubarItem>
          <MenubarSeparator />
          <MenubarItem>Add section</MenubarItem>
          <MenubarItem variant="destructive">Delete section</MenubarItem>
        </MenubarContent>
      </MenubarMenu>
      <MenubarMenu>
        <MenubarTrigger>Data</MenubarTrigger>
        <MenubarContent>
          <MenubarItem>Refresh</MenubarItem>
          <MenubarItem disabled>Edit query</MenubarItem>
        </MenubarContent>
      </MenubarMenu>
    </Menubar>
  )
}
```

## Usage

```tsx
import {
  Menubar,
  MenubarContent,
  MenubarItem,
  MenubarMenu,
  MenubarTrigger,
} from "@zenoxai/ui/components/menubar"
```

```tsx
<Menubar>
  <MenubarMenu>
    <MenubarTrigger>Report</MenubarTrigger>
    <MenubarContent>
      <MenubarItem onClick={createReport}>New report</MenubarItem>
      <MenubarItem onClick={exportPdf}>Export PDF</MenubarItem>
    </MenubarContent>
  </MenubarMenu>
  <MenubarMenu>
    <MenubarTrigger>Edit</MenubarTrigger>
    <MenubarContent>{/* items */}</MenubarContent>
  </MenubarMenu>
</Menubar>
```

Use a menubar at the top of a document-like workspace, such as a report or dashboard editor,
where the commands are many and fall into a few stable categories. Once one menu is open,
moving the pointer or pressing the left and right arrow keys opens its neighbors.

- For the actions of a single object (a row, a card), use a
  [Dropdown Menu](/components/dropdown-menu).
- For a shortcut on right-click, use a [Context Menu](/components/context-menu).
- For page navigation, use links in the sidebar or the page header, not a menubar.

Each `MenubarMenu` is a [Dropdown Menu](/components/dropdown-menu) with its own trigger, and
takes the same parts: items with shortcuts, a destructive variant, checkbox and radio items,
labels, separators and submenus.

## Examples

### Checkbox and radio items

A "View" menu holds display settings. Checkbox and radio items keep the menu open when toggled.
The check sits at the right edge, as in Dropdown Menu and Context Menu, so their text lines up
with labels and plain items without `inset`.

```tsx
import * as React from "react"
import { Menubar, MenubarCheckboxItem, MenubarContent, MenubarLabel, MenubarMenu, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarTrigger } from "@zenoxai/ui/components/menubar"

function MenubarWithOptions() {
  const [showFilters, setShowFilters] = React.useState(true)
  const [showSummary, setShowSummary] = React.useState(false)
  const [density, setDensity] = React.useState("compact")

  return (
    <Menubar>
      <MenubarMenu>
        <MenubarTrigger>View</MenubarTrigger>
        <MenubarContent className="w-52">
          <MenubarCheckboxItem
            checked={showFilters}
            onCheckedChange={setShowFilters}
          >
            Filter bar
          </MenubarCheckboxItem>
          <MenubarCheckboxItem
            checked={showSummary}
            onCheckedChange={setShowSummary}
          >
            Summary tiles
          </MenubarCheckboxItem>
          <MenubarSeparator />
          <MenubarLabel>Density</MenubarLabel>
          <MenubarRadioGroup value={density} onValueChange={setDensity}>
            <MenubarRadioItem value="compact">Compact</MenubarRadioItem>
            <MenubarRadioItem value="comfortable">Comfortable</MenubarRadioItem>
          </MenubarRadioGroup>
        </MenubarContent>
      </MenubarMenu>
    </Menubar>
  )
}
```

### Submenu

```tsx
import { Menubar, MenubarContent, MenubarItem, MenubarMenu, MenubarSeparator, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger } from "@zenoxai/ui/components/menubar"

function MenubarSubmenu() {
  return (
    <Menubar>
      <MenubarMenu>
        <MenubarTrigger>Share</MenubarTrigger>
        <MenubarContent className="w-48">
          <MenubarItem>Copy link</MenubarItem>
          <MenubarSub>
            <MenubarSubTrigger>Send to</MenubarSubTrigger>
            <MenubarSubContent>
              <MenubarItem>Email</MenubarItem>
              <MenubarItem>Slack channel</MenubarItem>
              <MenubarItem>Ticketing system</MenubarItem>
            </MenubarSubContent>
          </MenubarSub>
          <MenubarSeparator />
          <MenubarItem>Manage access</MenubarItem>
        </MenubarContent>
      </MenubarMenu>
    </Menubar>
  )
}
```

## Accessibility

- The bar has `role="menubar"`. Tab moves focus to the bar as a single stop; left and right
  arrow keys move between triggers, down arrow or Enter opens a menu, and Escape closes it.
- `MenubarShortcut` only displays the shortcut. Bind the key yourself.

## API reference

`import { ... } from "@zenoxai/ui/components/menubar"`

### Menubar

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| disabled | `boolean` | `false` | Whether the whole menubar is disabled. |
| loopFocus | `boolean` | `true` | Whether to loop keyboard focus back to the first item when the end of the list is reached while using the arrow keys. |
| modal | `boolean` | `true` | Whether the menubar is modal. |
| orientation | `"horizontal" \| "vertical"` | `'horizontal'` | The orientation of the menubar. |
| render | `ReactElement<unknown, string \| JSXElementConstructor<any>> \| ComponentRenderFn<HTMLProps, MenubarState>` |  | Allows you to replace the component's HTML element with a different tag, or compose it with another component.  Accepts a `ReactElement` or a function that returns the element to render. |

### MenubarPortal

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| container | `HTMLElement \| ShadowRoot \| RefObject<HTMLElement \| ShadowRoot \| null> \| null` |  | A parent element to render the portal element into. |
| keepMounted | `boolean` | `false` | Whether to keep the portal mounted in the DOM while the popup is hidden. |
| render | `ReactElement<unknown, string \| JSXElementConstructor<any>> \| ComponentRenderFn<HTMLProps, MenuPortalState>` |  | Allows you to replace the component's HTML element with a different tag, or compose it with another component.  Accepts a `ReactElement` or a function that returns the element to render. |

### MenubarMenu

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| actionsRef | `RefObject<MenuRootActions \| null>` |  | A ref to imperative actions. - `unmount`: Ends the closing phase of the menu after an externally controlled closing animation finishes.   Call `preventUnmountOnClose()` in `onOpenChange` first, otherwise the menu completes closing on its own.   Whether it leaves the DOM is decided by `keepMounted` on the portal. - `close`: Closes the menu imperatively when called. |
| closeParentOnEsc | `boolean` | `false` | When in a submenu, determines whether pressing the Escape key closes the entire menu, or only the current child menu. |
| defaultOpen | `boolean` | `false` | Whether the menu is initially open.  To render a controlled menu, use the `open` prop instead. |
| defaultTriggerId | `string \| null` |  | ID of the trigger that the menu is associated with. This is useful in conjunction with the `defaultOpen` prop to create an initially open menu. |
| disabled | `boolean` | `false` | Whether the component should ignore user interaction. |
| handle | `MenuHandle<unknown>` |  | A handle to associate the menu with a trigger. If specified, allows external triggers to control the menu's open state. |
| highlightItemOnHover | `boolean` | `true` | Whether moving the pointer over items should highlight them. Disabling this prop allows CSS `:hover` to be differentiated from the `:focus` (`data-highlighted`) state. |
| loopFocus | `boolean` | `true` | Whether to loop keyboard focus back to the first item when the end of the list is reached while using the arrow keys. |
| modal | `boolean` | `true` | Determines if the menu enters a modal state when open. - `true`: user interaction is limited to the menu: document page scroll is locked and pointer interactions on outside elements are disabled. - `false`: user interaction with the rest of the document is allowed.  On touch devices, a `true` modal blocks outside taps but leaves the page scrollable unless the popup spans nearly the full viewport width, matching native iOS behavior.  Nested menus ignore this prop, and menus opened by hover are never modal. |
| onItemHighlighted | `((highlightedItem: HTMLElement, eventDetails: MenuRootHighlightEventDetails) => void)` |  | Callback fired when an item is highlighted or unhighlighted. Receives the highlighted item element (or `undefined` if no item is highlighted) and details containing the reason for the change, the event, and the item's text label. The `reason` can be: - `'keyboard'`: the highlight changed due to keyboard navigation. - `'pointer'`: the highlight changed due to pointer hovering. The event may be a `MouseEvent`   rather than a `PointerEvent`. - `'none'`: the highlight changed for another reason, such as automatic highlighting while   filtering, the item list changing, or the popup opening or closing. |
| onOpenChange | `((open: boolean, eventDetails: MenuRootChangeEventDetails) => void)` |  | Event handler called when the menu is opened or closed. |
| onOpenChangeComplete | `((open: boolean) => void)` |  | Event handler called after any animations complete when the menu is opened or closed. |
| open | `boolean` |  | Whether the menu is currently open. |
| orientation | `"horizontal" \| "vertical"` | `'vertical'` | The visual orientation of the menu. Controls whether roving focus uses up/down or left/right arrow keys. |
| triggerId | `string \| null` |  | ID of the trigger that the menu is associated with. This is useful in conjunction with the `open` prop to create a controlled menu. There's no need to specify this prop when the menu is uncontrolled (that is, when the `open` prop is not set). |

### MenubarTrigger

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| closeDelay | `number` | `0` | How long to wait before closing the menu that was opened on hover. Specified in milliseconds.  Requires the `openOnHover` prop. |
| delay | `number` | `100` | How long to wait before the menu may be opened on hover. Specified in milliseconds.  Requires the `openOnHover` prop. |
| disabled | `boolean` | `false` | Whether the component should ignore user interaction. |
| handle | `MenuHandle<unknown>` |  | A handle to associate the trigger with a menu. |
| nativeButton | `boolean` | `true` | Whether the component renders a native `<button>` element when replacing it via the `render` prop. Set to `false` if the rendered element is not a button (for example, `<div>`). |
| openOnHover | `boolean` |  | Whether the menu should also open when the trigger is hovered. |
| payload | `unknown` |  | A payload to pass to the menu when it is opened. |
| render | `ReactElement<unknown, string \| JSXElementConstructor<any>> \| ComponentRenderFn<HTMLProps, MenuTriggerState>` |  | Allows you to replace the component's HTML element with a different tag, or compose it with another component.  Accepts a `ReactElement` or a function that returns the element to render. |

### MenubarContent

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| align | `"center" \| "start" \| "end"` | `start` | How to align the popup relative to the specified side.  Submenus and menubars default to `'start'`. |
| alignOffset | `number \| OffsetFunction` | `0` | Additional offset along the alignment axis in pixels. Also accepts a function that returns the offset to read the dimensions of the anchor and positioner elements, along with its side and alignment.  The function takes a `data` object parameter with the following properties: - `data.anchor`: the dimensions of the anchor element with properties `width` and `height`. - `data.positioner`: the dimensions of the positioner element with properties `width` and `height`. - `data.side`: which side of the anchor element the positioner is aligned against. - `data.align`: how the positioner is aligned relative to the specified side. @example ```jsx <Positioner   alignOffset={({ side, align, anchor, positioner }) => {     return side === 'top' \|\| side === 'bottom'       ? anchor.width       : anchor.height;   }} /> ``` |
| finalFocus | `boolean \| RefObject<HTMLElement \| null> \| ((closeType: InteractionType) => boolean \| void \| HTMLElement \| null)` |  | Determines the element to focus when the menu is closed.  - `false`: Do not move focus. - `true`: Move focus based on the default behavior (trigger or previously focused element). - `RefObject`: Move focus to the ref element. - `function`: Called with the interaction type (`mouse`, `touch`, `pen`, or `keyboard`).   Return an element to focus, `true` to use the default behavior, or `false`/`undefined` to do nothing. |
| id | `string` |  | @ignore |
| render | `ReactElement<unknown, string \| JSXElementConstructor<any>> \| ComponentRenderFn<HTMLProps, MenuPopupState>` |  | Allows you to replace the component's HTML element with a different tag, or compose it with another component.  Accepts a `ReactElement` or a function that returns the element to render. |
| side | `"left" \| "right" \| "top" \| "bottom" \| "inline-end" \| "inline-start"` | `bottom` | Which side of the anchor element to align the popup against. May automatically change to avoid collisions.  Submenus and vertical menubars default to `'inline-end'`. |
| sideOffset | `number \| OffsetFunction` | `0` | Distance between the anchor and the popup in pixels. Also accepts a function that returns the distance to read the dimensions of the anchor and positioner elements, along with its side and alignment.  The function takes a `data` object parameter with the following properties: - `data.anchor`: the dimensions of the anchor element with properties `width` and `height`. - `data.positioner`: the dimensions of the positioner element with properties `width` and `height`. - `data.side`: which side of the anchor element the positioner is aligned against. - `data.align`: how the positioner is aligned relative to the specified side. @example ```jsx <Positioner   sideOffset={({ side, align, anchor, positioner }) => {     return side === 'top' \|\| side === 'bottom'       ? anchor.height       : anchor.width;   }} /> ``` |

### MenubarGroup

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| render | `ReactElement<unknown, string \| JSXElementConstructor<any>> \| ComponentRenderFn<HTMLProps, MenuGroupState>` |  | Allows you to replace the component's HTML element with a different tag, or compose it with another component.  Accepts a `ReactElement` or a function that returns the element to render. |

### MenubarSeparator

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| orientation | `"horizontal" \| "vertical"` | `vertical` | The orientation of the separator. |
| render | `ReactElement<unknown, string \| JSXElementConstructor<any>> \| ComponentRenderFn<HTMLProps, SeparatorState>` |  | Allows you to replace the component's HTML element with a different tag, or compose it with another component.  Accepts a `ReactElement` or a function that returns the element to render. |

### MenubarLabel

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| inset | `boolean` |  | Indents the text to line up with items that have a leading icon. |

### MenubarItem

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| closeOnClick | `boolean` | `true` | Whether to close the menu when the item is clicked. |
| disabled | `boolean` | `false` | Whether the component should ignore user interaction. |
| id | `string` |  | @ignore |
| inset | `boolean` |  | Indents the text to line up with items that have a leading icon. |
| label | `string` |  | Overrides the text used for keyboard text navigation and filtering. Falls back to the rendered text when not provided. |
| nativeButton | `boolean` | `true` | Whether the component renders a native `<button>` element when replacing it via the `render` prop. Set to `false` if the rendered element is not a button (for example, `<div>`). |
| onClick | `((event: BaseUIEvent<MouseEvent<HTMLDivElement, MouseEvent>>) => void)` |  | The click handler for the menu item. |
| render | `ReactElement<unknown, string \| JSXElementConstructor<any>> \| ComponentRenderFn<HTMLProps, MenuItemState>` |  | Allows you to replace the component's HTML element with a different tag, or compose it with another component.  Accepts a `ReactElement` or a function that returns the element to render. |
| variant | `"default" \| "destructive"` | `default` | `destructive` colors the item red, for delete and other risky actions. |

### MenubarShortcut

No props of its own.

### MenubarCheckboxItem

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| checked | `boolean` |  | Whether the checkbox item is currently ticked.  To render an uncontrolled checkbox item, use the `defaultChecked` prop instead. |
| closeOnClick | `boolean` | `false` | Whether to close the menu when the item is clicked. |
| defaultChecked | `boolean` | `false` | Whether the checkbox item is initially ticked.  To render a controlled checkbox item, use the `checked` prop instead. |
| disabled | `boolean` | `false` | Whether the component should ignore user interaction. |
| id | `string` |  | @ignore |
| inset | `boolean` |  |  |
| label | `string` |  | Overrides the text used for keyboard text navigation and filtering. Falls back to the rendered text when not provided. |
| nativeButton | `boolean` | `true` | Whether the component renders a native `<button>` element when replacing it via the `render` prop. Set to `false` if the rendered element is not a button (for example, `<div>`). |
| onCheckedChange | `((checked: boolean, eventDetails: MenuRootChangeEventDetails) => void)` |  | Event handler called when the checkbox item is ticked or unticked. |
| onClick | `((event: BaseUIEvent<MouseEvent<HTMLDivElement, MouseEvent>>) => void)` |  | The click handler for the menu item. |
| render | `ReactElement<unknown, string \| JSXElementConstructor<any>> \| ComponentRenderFn<HTMLProps, MenuCheckboxItemState>` |  | Allows you to replace the component's HTML element with a different tag, or compose it with another component.  Accepts a `ReactElement` or a function that returns the element to render. |

### MenubarRadioGroup

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| defaultValue | `any` |  | The uncontrolled value of the radio item that should be initially selected.  To render a controlled radio group, use the `value` prop instead. |
| disabled | `boolean` | `false` | Whether the component should ignore user interaction. |
| onValueChange | `((value: any, eventDetails: MenuRootChangeEventDetails) => void)` |  | Function called when the selected value changes. |
| render | `ReactElement<unknown, string \| JSXElementConstructor<any>> \| ComponentRenderFn<HTMLProps, MenuRadioGroupState>` |  | Allows you to replace the component's HTML element with a different tag, or compose it with another component.  Accepts a `ReactElement` or a function that returns the element to render. |
| value | `any` |  | The controlled value of the radio item that should be currently selected.  To render an uncontrolled radio group, use the `defaultValue` prop instead. |

### MenubarRadioItem

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| closeOnClick | `boolean` | `false` | Whether to close the menu when the item is clicked. |
| disabled | `boolean` | `false` | Whether the component should ignore user interaction. |
| id | `string` |  | @ignore |
| inset | `boolean` |  |  |
| label | `string` |  | Overrides the text used for keyboard text navigation and filtering. Falls back to the rendered text when not provided. |
| nativeButton | `boolean` | `true` | Whether the component renders a native `<button>` element when replacing it via the `render` prop. Set to `false` if the rendered element is not a button (for example, `<div>`). |
| onClick | `((event: BaseUIEvent<MouseEvent<HTMLDivElement, MouseEvent>>) => void)` |  | The click handler for the menu item. |
| render | `ReactElement<unknown, string \| JSXElementConstructor<any>> \| ComponentRenderFn<HTMLProps, MenuRadioItemState>` |  | Allows you to replace the component's HTML element with a different tag, or compose it with another component.  Accepts a `ReactElement` or a function that returns the element to render. |
| value (required) | `any` |  | Value of the radio item. This is the value that will be set in the MenuRadioGroup when the item is selected. |

### MenubarSub

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| actionsRef | `RefObject<MenuRootActions \| null>` |  | A ref to imperative actions. - `unmount`: Ends the closing phase of the menu after an externally controlled closing animation finishes.   Call `preventUnmountOnClose()` in `onOpenChange` first, otherwise the menu completes closing on its own.   Whether it leaves the DOM is decided by `keepMounted` on the portal. - `close`: Closes the menu imperatively when called. |
| closeParentOnEsc | `boolean` | `false` | When in a submenu, determines whether pressing the Escape key closes the entire menu, or only the current child menu. |
| defaultOpen | `boolean` | `false` | Whether the menu is initially open.  To render a controlled menu, use the `open` prop instead. |
| disabled | `boolean` | `false` | Whether the component should ignore user interaction. |
| highlightItemOnHover | `boolean` | `true` | Whether moving the pointer over items should highlight them. Disabling this prop allows CSS `:hover` to be differentiated from the `:focus` (`data-highlighted`) state. |
| loopFocus | `boolean` | `true` | Whether to loop keyboard focus back to the first item when the end of the list is reached while using the arrow keys. |
| onItemHighlighted | `((highlightedItem: HTMLElement, eventDetails: MenuRootHighlightEventDetails) => void)` |  | Callback fired when an item is highlighted or unhighlighted. Receives the highlighted item element (or `undefined` if no item is highlighted) and details containing the reason for the change, the event, and the item's text label. The `reason` can be: - `'keyboard'`: the highlight changed due to keyboard navigation. - `'pointer'`: the highlight changed due to pointer hovering. The event may be a `MouseEvent`   rather than a `PointerEvent`. - `'none'`: the highlight changed for another reason, such as automatic highlighting while   filtering, the item list changing, or the popup opening or closing. |
| onOpenChange | `((open: boolean, eventDetails: MenuRootChangeEventDetails) => void)` |  | Event handler called when the menu is opened or closed. |
| onOpenChangeComplete | `((open: boolean) => void)` |  | Event handler called after any animations complete when the menu is opened or closed. |
| open | `boolean` |  | Whether the menu is currently open. |
| orientation | `"horizontal" \| "vertical"` | `'vertical'` | The visual orientation of the menu. Controls whether roving focus uses up/down or left/right arrow keys. |

### MenubarSubTrigger

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| closeDelay | `number` | `0` | How long to wait before closing the menu that was opened on hover. Specified in milliseconds.  Requires the `openOnHover` prop. |
| delay | `number` | `100` | How long to wait before the menu may be opened on hover. Specified in milliseconds.  Requires the `openOnHover` prop. |
| disabled | `boolean` | `false` | Whether the component should ignore user interaction. |
| id | `string` |  | @ignore |
| inset | `boolean` |  | Indents the text to line up with items that have a leading icon. |
| label | `string` |  | Overrides the text used for keyboard text navigation and filtering. Falls back to the rendered text when not provided. |
| nativeButton | `boolean` | `true` | Whether the component renders a native `<button>` element when replacing it via the `render` prop. Set to `false` if the rendered element is not a button (for example, `<div>`). |
| onClick | `((event: BaseUIEvent<MouseEvent<HTMLDivElement, MouseEvent>>) => void)` |  |  |
| openOnHover | `boolean` | `true` | Whether the menu should also open when the trigger is hovered. |
| render | `ReactElement<unknown, string \| JSXElementConstructor<any>> \| ComponentRenderFn<HTMLProps, MenuSubmenuTriggerState>` |  | Allows you to replace the component's HTML element with a different tag, or compose it with another component.  Accepts a `ReactElement` or a function that returns the element to render. |

### MenubarSubContent

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| align | `"center" \| "start" \| "end"` | `start` | How to align the popup relative to the specified side.  Submenus and menubars default to `'start'`. |
| alignOffset | `number \| OffsetFunction` | `0` | Additional offset along the alignment axis in pixels. Also accepts a function that returns the offset to read the dimensions of the anchor and positioner elements, along with its side and alignment.  The function takes a `data` object parameter with the following properties: - `data.anchor`: the dimensions of the anchor element with properties `width` and `height`. - `data.positioner`: the dimensions of the positioner element with properties `width` and `height`. - `data.side`: which side of the anchor element the positioner is aligned against. - `data.align`: how the positioner is aligned relative to the specified side. @example ```jsx <Positioner   alignOffset={({ side, align, anchor, positioner }) => {     return side === 'top' \|\| side === 'bottom'       ? anchor.width       : anchor.height;   }} /> ``` |
| finalFocus | `boolean \| RefObject<HTMLElement \| null> \| ((closeType: InteractionType) => boolean \| void \| HTMLElement \| null)` |  | Determines the element to focus when the menu is closed.  - `false`: Do not move focus. - `true`: Move focus based on the default behavior (trigger or previously focused element). - `RefObject`: Move focus to the ref element. - `function`: Called with the interaction type (`mouse`, `touch`, `pen`, or `keyboard`).   Return an element to focus, `true` to use the default behavior, or `false`/`undefined` to do nothing. |
| id | `string` |  | @ignore |
| render | `ReactElement<unknown, string \| JSXElementConstructor<any>> \| ComponentRenderFn<HTMLProps, MenuPopupState>` |  | Allows you to replace the component's HTML element with a different tag, or compose it with another component.  Accepts a `ReactElement` or a function that returns the element to render. |
| side | `"left" \| "right" \| "top" \| "bottom" \| "inline-end" \| "inline-start"` | `bottom` | Which side of the anchor element to align the popup against. May automatically change to avoid collisions.  Submenus and vertical menubars default to `'inline-end'`. |
| sideOffset | `number \| OffsetFunction` | `0` | Distance between the anchor and the popup in pixels. Also accepts a function that returns the distance to read the dimensions of the anchor and positioner elements, along with its side and alignment.  The function takes a `data` object parameter with the following properties: - `data.anchor`: the dimensions of the anchor element with properties `width` and `height`. - `data.positioner`: the dimensions of the positioner element with properties `width` and `height`. - `data.side`: which side of the anchor element the positioner is aligned against. - `data.align`: how the positioner is aligned relative to the specified side. @example ```jsx <Positioner   sideOffset={({ side, align, anchor, positioner }) => {     return side === 'top' \|\| side === 'bottom'       ? anchor.height       : anchor.width;   }} /> ``` |

