# Dropdown Menu

A list of actions or options that opens from a button.

```tsx
import { CopyIcon, EyeIcon, MoreHorizontalIcon, Trash2Icon, UserPlusIcon } from "lucide-react"
import { Button } from "@zenoxai/ui/components/button"
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuTrigger } from "@zenoxai/ui/components/dropdown-menu"

function DropdownMenuDemo() {
  return (
    <DropdownMenu>
      <DropdownMenuTrigger
        render={
          <Button variant="outline" size="icon" aria-label="Alert actions" />
        }
      >
        <MoreHorizontalIcon />
      </DropdownMenuTrigger>
      <DropdownMenuContent className="w-52">
        <DropdownMenuItem>
          <EyeIcon />
          View details
        </DropdownMenuItem>
        <DropdownMenuItem>
          <UserPlusIcon />
          Assign to me
          <DropdownMenuShortcut>A</DropdownMenuShortcut>
        </DropdownMenuItem>
        <DropdownMenuItem>
          <CopyIcon />
          Copy alert ID
          <DropdownMenuShortcut>⌘C</DropdownMenuShortcut>
        </DropdownMenuItem>
        <DropdownMenuSeparator />
        <DropdownMenuItem variant="destructive">
          <Trash2Icon />
          Delete alert
        </DropdownMenuItem>
      </DropdownMenuContent>
    </DropdownMenu>
  )
}
```

## Usage

```tsx
import { Button } from "@zenoxai/ui/components/button"
import {
  DropdownMenu,
  DropdownMenuContent,
  DropdownMenuItem,
  DropdownMenuSeparator,
  DropdownMenuTrigger,
} from "@zenoxai/ui/components/dropdown-menu"
```

```tsx
<DropdownMenu>
  <DropdownMenuTrigger render={<Button variant="outline" />}>
    Actions
  </DropdownMenuTrigger>
  <DropdownMenuContent>
    <DropdownMenuItem onClick={viewDetails}>View details</DropdownMenuItem>
    <DropdownMenuItem onClick={assign}>Assign to me</DropdownMenuItem>
    <DropdownMenuSeparator />
    <DropdownMenuItem variant="destructive" onClick={remove}>
      Delete alert
    </DropdownMenuItem>
  </DropdownMenuContent>
</DropdownMenu>
```

Use a dropdown menu to group actions behind one button: the actions of a table row, the
settings of a tenant, export options. Items run on click and the menu closes.

| Need                                                                     | Use                                                              |
| ------------------------------------------------------------------------ | ---------------------------------------------------------------- |
| The same actions on right-click, as a shortcut                           | [Context Menu](/components/context-menu)                         |
| A row of menus at the top of an editor or app ("Report", "Edit", "View") | [Menubar](/components/menubar)                                   |
| A value for a form field                                                 | [Select](/components/select) or [Combobox](/components/combobox) |
| A searchable list of many commands                                       | [Command](/components/command)                                   |
| Controls other than items (inputs, sliders)                              | [Popover](/components/popover)                                   |

`DropdownMenuContent` opens below the trigger, aligned to its start edge, and is as wide as the
trigger with a minimum of 9rem. Set a width with `className` (`w-52`) when the trigger is
narrow, as with an icon button. Put the destructive item last, after a separator.

## Examples

### Groups and labels

Separate related items with `DropdownMenuSeparator` and head each group with a
`DropdownMenuLabel`. A disabled item stays visible, so the user learns the action exists.

```tsx
import { Button } from "@zenoxai/ui/components/button"
import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "@zenoxai/ui/components/dropdown-menu"

function DropdownMenuGroups() {
  return (
    <DropdownMenu>
      <DropdownMenuTrigger render={<Button variant="outline" />}>
        Acme Corp
      </DropdownMenuTrigger>
      <DropdownMenuContent className="w-56">
        <DropdownMenuGroup>
          <DropdownMenuLabel>Tenant</DropdownMenuLabel>
          <DropdownMenuItem>Settings</DropdownMenuItem>
          <DropdownMenuItem>Users and roles</DropdownMenuItem>
          <DropdownMenuItem>Billing</DropdownMenuItem>
        </DropdownMenuGroup>
        <DropdownMenuSeparator />
        <DropdownMenuGroup>
          <DropdownMenuLabel>Data</DropdownMenuLabel>
          <DropdownMenuItem>Integrations</DropdownMenuItem>
          <DropdownMenuItem disabled>Data retention</DropdownMenuItem>
        </DropdownMenuGroup>
      </DropdownMenuContent>
    </DropdownMenu>
  )
}
```

### Checkbox items

`DropdownMenuCheckboxItem` toggles a setting and keeps the menu open, so the user can change
several in a row. Control it with `checked` and `onCheckedChange`.

```tsx
import * as React from "react"
import { Button } from "@zenoxai/ui/components/button"
import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuLabel, DropdownMenuTrigger } from "@zenoxai/ui/components/dropdown-menu"

function DropdownMenuCheckboxes() {
  const [columns, setColumns] = React.useState({
    severity: true,
    asset: true,
    tenant: false,
    assignee: true,
  })

  return (
    <DropdownMenu>
      <DropdownMenuTrigger render={<Button variant="outline" />}>
        Columns
      </DropdownMenuTrigger>
      <DropdownMenuContent className="w-48">
        <DropdownMenuLabel>Show columns</DropdownMenuLabel>
        {(
          [
            ["severity", "Severity"],
            ["asset", "Asset"],
            ["tenant", "Tenant"],
            ["assignee", "Assignee"],
          ] as const
        ).map(([key, label]) => (
          <DropdownMenuCheckboxItem
            key={key}
            checked={columns[key]}
            onCheckedChange={(checked) =>
              setColumns((current) => ({ ...current, [key]: checked }))
            }
          >
            {label}
          </DropdownMenuCheckboxItem>
        ))}
      </DropdownMenuContent>
    </DropdownMenu>
  )
}
```

### Radio items

`DropdownMenuRadioGroup` holds a single choice, such as the sort order of a list. Control it with
`value` and `onValueChange`.

```tsx
import * as React from "react"
import { Button } from "@zenoxai/ui/components/button"
import { DropdownMenu, DropdownMenuContent, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuTrigger } from "@zenoxai/ui/components/dropdown-menu"

function DropdownMenuRadio() {
  const [sort, setSort] = React.useState("severity")

  return (
    <DropdownMenu>
      <DropdownMenuTrigger render={<Button variant="outline" />}>
        Sort alerts
      </DropdownMenuTrigger>
      <DropdownMenuContent className="w-48">
        <DropdownMenuLabel>Sort by</DropdownMenuLabel>
        <DropdownMenuRadioGroup value={sort} onValueChange={setSort}>
          <DropdownMenuRadioItem value="severity">
            Severity
          </DropdownMenuRadioItem>
          <DropdownMenuRadioItem value="newest">
            Newest first
          </DropdownMenuRadioItem>
          <DropdownMenuRadioItem value="oldest">
            Oldest first
          </DropdownMenuRadioItem>
        </DropdownMenuRadioGroup>
      </DropdownMenuContent>
    </DropdownMenu>
  )
}
```

### Submenu

`DropdownMenuSub` nests a menu that opens to the side on hover, click or the right arrow key.
Keep to one level.

```tsx
import { Button } from "@zenoxai/ui/components/button"
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger } from "@zenoxai/ui/components/dropdown-menu"

function DropdownMenuSubmenu() {
  return (
    <DropdownMenu>
      <DropdownMenuTrigger render={<Button variant="outline" />}>
        Export
      </DropdownMenuTrigger>
      <DropdownMenuContent className="w-48">
        <DropdownMenuItem>Current page</DropdownMenuItem>
        <DropdownMenuItem>All 1,284 alerts</DropdownMenuItem>
        <DropdownMenuSeparator />
        <DropdownMenuSub>
          <DropdownMenuSubTrigger>Format</DropdownMenuSubTrigger>
          <DropdownMenuSubContent>
            <DropdownMenuItem>CSV</DropdownMenuItem>
            <DropdownMenuItem>JSON</DropdownMenuItem>
            <DropdownMenuItem>PDF report</DropdownMenuItem>
          </DropdownMenuSubContent>
        </DropdownMenuSub>
      </DropdownMenuContent>
    </DropdownMenu>
  )
}
```

## Accessibility

- The trigger has `aria-haspopup` and `aria-expanded`. Enter, Space and the arrow keys open the
  menu; arrow keys move between items, typing a letter jumps to the matching item, and Escape
  closes the menu and returns focus to the trigger.
- An icon-only trigger needs an `aria-label` that names the menu ("Alert actions").
- `DropdownMenuShortcut` only displays the shortcut. Bind the key yourself.
- `DropdownMenuLabel` is a visual heading and is not announced as the group's name.

## API reference

`import { ... } from "@zenoxai/ui/components/dropdown-menu"`

### DropdownMenu

| 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). |

### DropdownMenuPortal

| 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. |

### DropdownMenuTrigger

| 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. |

### DropdownMenuContent

| 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;   }} /> ``` |

### DropdownMenuGroup

| 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. |

### DropdownMenuLabel

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

### DropdownMenuItem

| 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. |

### DropdownMenuCheckboxItem

| 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` |  | 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>`). |
| 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. |

### DropdownMenuRadioGroup

| 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. |

### DropdownMenuRadioItem

| 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` |  | 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, 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. |

### DropdownMenuSeparator

| 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. |

### DropdownMenuShortcut

No props of its own.

### DropdownMenuSub

| 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. |

### DropdownMenuSubTrigger

| 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. |

### DropdownMenuSubContent

| 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;   }} /> ``` |

