# Dropdown Menu

A menu of actions or options opened from a button.

Source: [dropdown-menu.tsx](https://github.com/jakejarvis/jarvis-ui/blob/main/src/components/ui/dropdown-menu.tsx)

```tsx
import {
  CreditCardIcon,
  KeyboardIcon,
  LifeBuoyIcon,
  LogOutIcon,
  MoonIcon,
  SettingsIcon,
  SunIcon,
  SunMoonIcon,
  UserIcon,
  UsersIcon,
} from "lucide-react";
import * as React from "react";

import { Avatar, AvatarFallback } from "@/components/ui/avatar";
import { Button } from "@/components/ui/button";
import {
  DropdownMenu,
  DropdownMenuContent,
  DropdownMenuGroup,
  DropdownMenuItem,
  DropdownMenuLabel,
  DropdownMenuRadioGroup,
  DropdownMenuRadioItem,
  DropdownMenuSeparator,
  DropdownMenuShortcut,
  DropdownMenuSub,
  DropdownMenuSubContent,
  DropdownMenuSubTrigger,
  DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";

export default function DropdownMenuAccount() {
  const [theme, setTheme] = React.useState("system");
  return (
    <DropdownMenu>
      <DropdownMenuTrigger render={<Button variant="ghost" className="pl-1" />}>
        <Avatar size="sm">
          <AvatarFallback>AP</AvatarFallback>
        </Avatar>
        Ada Park
      </DropdownMenuTrigger>
      <DropdownMenuContent className="w-56">
        <DropdownMenuGroup>
          <DropdownMenuLabel>ada@example.com</DropdownMenuLabel>
          <DropdownMenuItem>
            <UserIcon />
            Profile
            <DropdownMenuShortcut>⇧⌘P</DropdownMenuShortcut>
          </DropdownMenuItem>
          <DropdownMenuItem>
            <CreditCardIcon />
            Billing
          </DropdownMenuItem>
          <DropdownMenuItem>
            <SettingsIcon />
            Settings
            <DropdownMenuShortcut>⌘,</DropdownMenuShortcut>
          </DropdownMenuItem>
          <DropdownMenuSub>
            <DropdownMenuSubTrigger>
              <SunMoonIcon />
              Theme
            </DropdownMenuSubTrigger>
            <DropdownMenuSubContent>
              <DropdownMenuRadioGroup value={theme} onValueChange={setTheme}>
                <DropdownMenuRadioItem value="light">
                  <SunIcon />
                  Light
                </DropdownMenuRadioItem>
                <DropdownMenuRadioItem value="dark">
                  <MoonIcon />
                  Dark
                </DropdownMenuRadioItem>
                <DropdownMenuRadioItem value="system">
                  <SunMoonIcon />
                  System
                </DropdownMenuRadioItem>
              </DropdownMenuRadioGroup>
            </DropdownMenuSubContent>
          </DropdownMenuSub>
        </DropdownMenuGroup>
        <DropdownMenuSeparator />
        <DropdownMenuItem>
          <UsersIcon />
          Invite people
        </DropdownMenuItem>
        <DropdownMenuItem>
          <LifeBuoyIcon />
          Help
        </DropdownMenuItem>
        <DropdownMenuItem disabled>
          <KeyboardIcon />
          Shortcuts
        </DropdownMenuItem>
        <DropdownMenuSeparator />
        <DropdownMenuItem variant="destructive">
          <LogOutIcon />
          Sign out
        </DropdownMenuItem>
      </DropdownMenuContent>
    </DropdownMenu>
  );
}
```

## Installation

Add the registry, once per project:

```bash
npx shadcn@latest registry add @jarvis=https://ui.jarv.is/r/{name}.json
```

Then add the component:

```bash
npx shadcn@latest add @jarvis/dropdown-menu
```

## Usage

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

export function FileMenu() {
  return (
    <DropdownMenu>
      <DropdownMenuTrigger render={<Button variant="secondary" />}>File</DropdownMenuTrigger>
      <DropdownMenuContent>
        <DropdownMenuGroup>
          <DropdownMenuLabel>Document</DropdownMenuLabel>
          <DropdownMenuItem>
            New
            <DropdownMenuShortcut>⌘N</DropdownMenuShortcut>
          </DropdownMenuItem>
          <DropdownMenuItem>Rename</DropdownMenuItem>
        </DropdownMenuGroup>
        <DropdownMenuSeparator />
        <DropdownMenuItem variant="destructive">Delete</DropdownMenuItem>
      </DropdownMenuContent>
    </DropdownMenu>
  );
}
```

Handle an item with `onClick`. `DropdownMenuShortcut` only displays a shortcut, so bind the keys
yourself. Keep each `DropdownMenuLabel` inside a `DropdownMenuGroup`.

Items also take `variant="destructive"` and `disabled`.

## Composition

- `DropdownMenu`
  - `DropdownMenuTrigger`
  - `DropdownMenuContent`
    - `DropdownMenuItem`
      - `DropdownMenuShortcut`
    - `DropdownMenuGroup`
      - `DropdownMenuLabel`
    - `DropdownMenuSeparator`
    - `DropdownMenuCheckboxItem`
    - `DropdownMenuRadioGroup`
      - `DropdownMenuRadioItem`
    - `DropdownMenuSub`
      - `DropdownMenuSubTrigger`
      - `DropdownMenuSubContent`

## Examples

### Icon trigger

Give an icon-only trigger an `aria-label`. `align="end"` lines the menu up with its right edge.

```tsx
import { ArchiveIcon, CopyIcon, EllipsisIcon, PencilIcon, Trash2Icon } from "lucide-react";

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

export default function DropdownMenuIconTrigger() {
  return (
    <DropdownMenu>
      <DropdownMenuTrigger
        render={<Button variant="ghost" size="icon" aria-label="More actions" />}
      >
        <EllipsisIcon />
      </DropdownMenuTrigger>
      <DropdownMenuContent align="end">
        <DropdownMenuItem>
          <PencilIcon />
          Rename
        </DropdownMenuItem>
        <DropdownMenuItem>
          <CopyIcon />
          Duplicate
        </DropdownMenuItem>
        <DropdownMenuItem>
          <ArchiveIcon />
          Archive
        </DropdownMenuItem>
        <DropdownMenuSeparator />
        <DropdownMenuItem variant="destructive">
          <Trash2Icon />
          Delete
        </DropdownMenuItem>
      </DropdownMenuContent>
    </DropdownMenu>
  );
}
```

### Checkbox items

`DropdownMenuCheckboxItem` toggles a setting with `checked` and `onCheckedChange`.

```tsx
import { ListFilterIcon } from "lucide-react";
import * as React from "react";

import { Button } from "@/components/ui/button";
import {
  DropdownMenu,
  DropdownMenuCheckboxItem,
  DropdownMenuContent,
  DropdownMenuGroup,
  DropdownMenuLabel,
  DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";

export default function DropdownMenuCheckboxItems() {
  const [showCompleted, setShowCompleted] = React.useState(true);
  const [showArchived, setShowArchived] = React.useState(false);
  return (
    <DropdownMenu>
      <DropdownMenuTrigger render={<Button variant="secondary" />}>
        <ListFilterIcon />
        View
      </DropdownMenuTrigger>
      <DropdownMenuContent>
        <DropdownMenuGroup>
          <DropdownMenuLabel>Show</DropdownMenuLabel>
          <DropdownMenuCheckboxItem checked={showCompleted} onCheckedChange={setShowCompleted}>
            Completed tasks
          </DropdownMenuCheckboxItem>
          <DropdownMenuCheckboxItem checked={showArchived} onCheckedChange={setShowArchived}>
            Archived tasks
          </DropdownMenuCheckboxItem>
        </DropdownMenuGroup>
      </DropdownMenuContent>
    </DropdownMenu>
  );
}
```

### Radio items

Wrap `DropdownMenuRadioItem`s in a `DropdownMenuRadioGroup` to pick one of several options.

```tsx
import { ArrowUpDownIcon } from "lucide-react";
import * as React from "react";

import { Button } from "@/components/ui/button";
import {
  DropdownMenu,
  DropdownMenuContent,
  DropdownMenuGroup,
  DropdownMenuLabel,
  DropdownMenuRadioGroup,
  DropdownMenuRadioItem,
  DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";

export default function DropdownMenuRadioItems() {
  const [sort, setSort] = React.useState("due");
  return (
    <DropdownMenu>
      <DropdownMenuTrigger render={<Button variant="secondary" />}>
        <ArrowUpDownIcon />
        Sort
      </DropdownMenuTrigger>
      <DropdownMenuContent>
        <DropdownMenuGroup>
          <DropdownMenuLabel>Sort by</DropdownMenuLabel>
          <DropdownMenuRadioGroup value={sort} onValueChange={setSort}>
            <DropdownMenuRadioItem value="due">Due date</DropdownMenuRadioItem>
            <DropdownMenuRadioItem value="priority">Priority</DropdownMenuRadioItem>
            <DropdownMenuRadioItem value="updated">Last updated</DropdownMenuRadioItem>
          </DropdownMenuRadioGroup>
        </DropdownMenuGroup>
      </DropdownMenuContent>
    </DropdownMenu>
  );
}
```

### Submenus

Nest a menu with `DropdownMenuSub`, `DropdownMenuSubTrigger` and `DropdownMenuSubContent`.

```tsx
import { CopyIcon, FolderIcon, FolderInputIcon, PencilIcon } from "lucide-react";

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

const projects = ["Website redesign", "Mobile app", "Brand guidelines"];

export default function DropdownMenuSubmenu() {
  return (
    <DropdownMenu>
      <DropdownMenuTrigger render={<Button variant="secondary" />}>Task</DropdownMenuTrigger>
      <DropdownMenuContent>
        <DropdownMenuItem>
          <PencilIcon />
          Edit
        </DropdownMenuItem>
        <DropdownMenuItem>
          <CopyIcon />
          Duplicate
        </DropdownMenuItem>
        <DropdownMenuSub>
          <DropdownMenuSubTrigger>
            <FolderInputIcon />
            Move to
          </DropdownMenuSubTrigger>
          <DropdownMenuSubContent>
            {projects.map((project) => (
              <DropdownMenuItem key={project}>
                <FolderIcon />
                {project}
              </DropdownMenuItem>
            ))}
          </DropdownMenuSubContent>
        </DropdownMenuSub>
      </DropdownMenuContent>
    </DropdownMenu>
  );
}
```

## Props

Items, labels and submenu triggers take `inset` to line up with items that have an icon.

| Part | Extends |
| --- | --- |
| `DropdownMenu` | [`Menu.Root`](https://base-ui.com/react/components/menu#root) |
| `DropdownMenuPortal` | [`Menu.Portal`](https://base-ui.com/react/components/menu#portal) |
| `DropdownMenuTrigger` | [`Menu.Trigger`](https://base-ui.com/react/components/menu#trigger) |
| `DropdownMenuContent` | [`Menu.Popup`](https://base-ui.com/react/components/menu#popup) |
| `DropdownMenuGroup` | [`Menu.Group`](https://base-ui.com/react/components/menu#group) |
| `DropdownMenuLabel` | [`Menu.GroupLabel`](https://base-ui.com/react/components/menu#grouplabel) |
| `DropdownMenuItem` | [`Menu.Item`](https://base-ui.com/react/components/menu#item) |
| `DropdownMenuSub` | [`Menu.SubmenuRoot`](https://base-ui.com/react/components/menu#submenuroot) |
| `DropdownMenuSubTrigger` | [`Menu.SubmenuTrigger`](https://base-ui.com/react/components/menu#submenutrigger) |
| `DropdownMenuSubContent` | `DropdownMenuContent` |
| `DropdownMenuCheckboxItem` | [`Menu.CheckboxItem`](https://base-ui.com/react/components/menu#checkboxitem) |
| `DropdownMenuRadioGroup` | [`Menu.RadioGroup`](https://base-ui.com/react/components/menu#radiogroup) |
| `DropdownMenuRadioItem` | [`Menu.RadioItem`](https://base-ui.com/react/components/menu#radioitem) |
| `DropdownMenuSeparator` | [`Menu.Separator`](https://base-ui.com/react/components/menu#separator) |
| `DropdownMenuShortcut` | `<span>` |

The tables leave out `className`, `style` and `render`. Parts built on Base UI take them as its [styling](https://base-ui.com/react/handbook/styling) and [composition](https://base-ui.com/react/handbook/composition) guides describe.

### DropdownMenu

| Prop                    | Type                                                                                                   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ----------------------- | ------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `defaultOpen?`          | `boolean`                                                                                              | Whether the menu is initially open. To render a controlled menu, use the `open` prop instead. Default: `false`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `loopFocus?`            | `boolean`                                                                                              | Whether to loop keyboard focus back to the first item when the end of the list is reached while using the arrow keys. Default: `true`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `highlightItemOnHover?` | `boolean`                                                                                              | Whether moving the pointer over items should highlight them. Disabling this prop allows CSS `:hover` to be differentiated from the `:focus` (`data-highlighted`) state. Default: `true`                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `modal?`                | `boolean`                                                                                              | 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. Default: `true`                                                                            |
| `onOpenChange?`         | `((open: boolean, eventDetails: Menu.Root.ChangeEventDetails) => 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.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `onItemHighlighted?`    | `((highlightedItem: HTMLElement \| undefined, eventDetails: Menu.Root.HighlightEventDetails) => 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. |
| `open?`                 | `boolean`                                                                                              | Whether the menu is currently open.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `orientation?`          | `"horizontal" \| "vertical"`                                                                           | The visual orientation of the menu. Controls whether roving focus uses up/down or left/right arrow keys. Default: `'vertical'`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `disabled?`             | `boolean`                                                                                              | Whether the component should ignore user interaction. Default: `false`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `closeParentOnEsc?`     | `boolean`                                                                                              | When in a submenu, determines whether pressing the Escape key closes the entire menu, or only the current child menu. Default: `false`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `actionsRef?`           | `React.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.                                                                                                                                                                                                                                              |
| `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).                                                                                                                                                                                                                                                                                                                                                                      |
| `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.                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `handle?`               | `Menu.Handle<unknown>`                                                                                 | A handle to associate the menu with a trigger. If specified, allows external triggers to control the menu's open state.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `children?`             | `PayloadChildRenderFunction<unknown> \| React.ReactNode`                                               | The content of the menu. This can be a regular React node or a render function that receives the `payload` of the active trigger.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |

### DropdownMenuPortal

| Prop           | Type                                                                                      | Description                                                                               |
| -------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
| `keepMounted?` | `boolean`                                                                                 | Whether to keep the portal mounted in the DOM while the popup is hidden. Default: `false` |
| `container?`   | `HTMLElement \| React.RefObject<HTMLElement \| ShadowRoot \| null> \| ShadowRoot \| null` | A parent element to render the portal element into.                                       |

### DropdownMenuTrigger

| Prop            | Type                   | Description                                                                                                                                                                                       |
| --------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `children?`     | `React.ReactNode`      |                                                                                                                                                                                                   |
| `disabled?`     | `boolean`              | Whether the component should ignore user interaction. Default: `false`                                                                                                                            |
| `handle?`       | `Menu.Handle<unknown>` | A handle to associate the trigger with a menu.                                                                                                                                                    |
| `payload?`      | `unknown`              | A payload to pass to the menu when it is opened.                                                                                                                                                  |
| `delay?`        | `number`               | How long to wait before the menu may be opened on hover. Specified in milliseconds. Requires the `openOnHover` prop. Default: `100`                                                               |
| `closeDelay?`   | `number`               | How long to wait before closing the menu that was opened on hover. Specified in milliseconds. Requires the `openOnHover` prop. Default: `0`                                                       |
| `openOnHover?`  | `boolean`              | Whether the menu should also open when the trigger is hovered.                                                                                                                                    |
| `nativeButton?` | `boolean`              | 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>`). Default: `true` |

### DropdownMenuContent

| Prop           | Type                                                                                                                          | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| -------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `children?`    | `React.ReactNode`                                                                                                             |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `id?`          | `string`                                                                                                                      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `finalFocus?`  | `boolean \| React.RefObject<HTMLElement \| null> \| ((closeType: InteractionType) => boolean \| HTMLElement \| null \| void)` | 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.                                                                                                                                                                                                                                   |
| `sideOffset?`  | `number \| OffsetFunction`                                                                                                    | 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. Default: `4` |
| `alignOffset?` | `number \| OffsetFunction`                                                                                                    | 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. Default: `0`  |
| `align?`       | `"center" \| "end" \| "start"`                                                                                                | How to align the popup relative to the specified side. Submenus and menubars default to `'start'`. Default: `"start"`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `side?`        | `"bottom" \| "inline-end" \| "inline-start" \| "left" \| "right" \| "top"`                                                    | 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'`. Default: `"bottom"`                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |

### DropdownMenuGroup

| Prop        | Type              | Description                   |
| ----------- | ----------------- | ----------------------------- |
| `children?` | `React.ReactNode` | The content of the component. |

### DropdownMenuLabel

| Prop     | Type      | Description |
| -------- | --------- | ----------- |
| `inset?` | `boolean` |             |

### DropdownMenuItem

| Prop            | Type                                                                           | Description                                                                                                                                                                   |
| --------------- | ------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `onClick?`      | `((event: BaseUIEvent<React.MouseEvent<HTMLDivElement, MouseEvent>>) => void)` | The click handler for the menu item.                                                                                                                                          |
| `disabled?`     | `boolean`                                                                      | Whether the component should ignore user interaction. Default: `false`                                                                                                        |
| `label?`        | `string`                                                                       | Overrides the text used for keyboard text navigation and filtering. Falls back to the rendered text when not provided.                                                        |
| `id?`           | `string`                                                                       |                                                                                                                                                                               |
| `closeOnClick?` | `boolean`                                                                      | Whether to close the menu when the item is clicked. Default: `true`                                                                                                           |
| `nativeButton?` | `boolean`                                                                      | Whether the component renders a native `<button>` element when replacing it via the `render` prop. Set to `true` if the rendered element is a native button. Default: `false` |
| `inset?`        | `boolean`                                                                      |                                                                                                                                                                               |
| `variant?`      | `"default" \| "destructive"`                                                   | Default: `"default"`                                                                                                                                                          |

### DropdownMenuSub

| Prop                    | Type                                                                                                   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ----------------------- | ------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `onOpenChange?`         | `((open: boolean, eventDetails: Menu.SubmenuRoot.ChangeEventDetails) => void)`                         | Event handler called when the menu is opened or closed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `closeParentOnEsc?`     | `boolean`                                                                                              | When in a submenu, determines whether pressing the Escape key closes the entire menu, or only the current child menu. Default: `false`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `children?`             | `React.ReactNode`                                                                                      | The content of the submenu.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `defaultOpen?`          | `boolean`                                                                                              | Whether the menu is initially open. To render a controlled menu, use the `open` prop instead. Default: `false`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `loopFocus?`            | `boolean`                                                                                              | Whether to loop keyboard focus back to the first item when the end of the list is reached while using the arrow keys. Default: `true`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `highlightItemOnHover?` | `boolean`                                                                                              | Whether moving the pointer over items should highlight them. Disabling this prop allows CSS `:hover` to be differentiated from the `:focus` (`data-highlighted`) state. Default: `true`                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `onOpenChangeComplete?` | `((open: boolean) => void)`                                                                            | Event handler called after any animations complete when the menu is opened or closed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `onItemHighlighted?`    | `((highlightedItem: HTMLElement \| undefined, eventDetails: Menu.Root.HighlightEventDetails) => 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. |
| `open?`                 | `boolean`                                                                                              | Whether the menu is currently open.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `orientation?`          | `"horizontal" \| "vertical"`                                                                           | The visual orientation of the menu. Controls whether roving focus uses up/down or left/right arrow keys. Default: `'vertical'`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `disabled?`             | `boolean`                                                                                              | Whether the component should ignore user interaction. Default: `false`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `actionsRef?`           | `React.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.                                                                                                                                                                                                                                              |

### DropdownMenuSubTrigger

| Prop            | Type                                                                           | Description                                                                                                                                                                   |
| --------------- | ------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `onClick?`      | `((event: BaseUIEvent<React.MouseEvent<HTMLDivElement, MouseEvent>>) => void)` |                                                                                                                                                                               |
| `label?`        | `string`                                                                       | Overrides the text used for keyboard text navigation and filtering. Falls back to the rendered text when not provided.                                                        |
| `id?`           | `string`                                                                       |                                                                                                                                                                               |
| `disabled?`     | `boolean`                                                                      | Whether the component should ignore user interaction. Default: `false`                                                                                                        |
| `delay?`        | `number`                                                                       | How long to wait before the menu may be opened on hover. Specified in milliseconds. Requires the `openOnHover` prop. Default: `100`                                           |
| `closeDelay?`   | `number`                                                                       | How long to wait before closing the menu that was opened on hover. Specified in milliseconds. Requires the `openOnHover` prop. Default: `0`                                   |
| `openOnHover?`  | `boolean`                                                                      | Whether the menu should also open when the trigger is hovered. Default: `true`                                                                                                |
| `nativeButton?` | `boolean`                                                                      | Whether the component renders a native `<button>` element when replacing it via the `render` prop. Set to `true` if the rendered element is a native button. Default: `false` |
| `inset?`        | `boolean`                                                                      |                                                                                                                                                                               |

### DropdownMenuSubContent

| Prop           | Type                                                                                                                          | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| -------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `children?`    | `React.ReactNode`                                                                                                             |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `id?`          | `string`                                                                                                                      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `finalFocus?`  | `boolean \| React.RefObject<HTMLElement \| null> \| ((closeType: InteractionType) => boolean \| HTMLElement \| null \| void)` | 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.                                                                                                                                                                                                                                   |
| `sideOffset?`  | `number \| OffsetFunction`                                                                                                    | 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. Default: `2` |
| `alignOffset?` | `number \| OffsetFunction`                                                                                                    | 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. Default: `-2` |
| `align?`       | `"center" \| "end" \| "start"`                                                                                                | How to align the popup relative to the specified side. Submenus and menubars default to `'start'`. Default: `"start"`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `side?`        | `"bottom" \| "inline-end" \| "inline-start" \| "left" \| "right" \| "top"`                                                    | 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'`. Default: `"right"`                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |

### DropdownMenuCheckboxItem

| Prop               | Type                                                                               | Description                                                                                                                                                                   |
| ------------------ | ---------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `checked?`         | `boolean`                                                                          | Whether the checkbox item is currently ticked. To render an uncontrolled checkbox item, use the `defaultChecked` prop instead.                                                |
| `defaultChecked?`  | `boolean`                                                                          | Whether the checkbox item is initially ticked. To render a controlled checkbox item, use the `checked` prop instead. Default: `false`                                         |
| `onCheckedChange?` | `((checked: boolean, eventDetails: Menu.CheckboxItem.ChangeEventDetails) => void)` | Event handler called when the checkbox item is ticked or unticked.                                                                                                            |
| `onClick?`         | `((event: BaseUIEvent<React.MouseEvent<HTMLDivElement, MouseEvent>>) => void)`     | The click handler for the menu item.                                                                                                                                          |
| `disabled?`        | `boolean`                                                                          | Whether the component should ignore user interaction. Default: `false`                                                                                                        |
| `label?`           | `string`                                                                           | Overrides the text used for keyboard text navigation and filtering. Falls back to the rendered text when not provided.                                                        |
| `id?`              | `string`                                                                           |                                                                                                                                                                               |
| `closeOnClick?`    | `boolean`                                                                          | Whether to close the menu when the item is clicked. Default: `false`                                                                                                          |
| `nativeButton?`    | `boolean`                                                                          | Whether the component renders a native `<button>` element when replacing it via the `render` prop. Set to `true` if the rendered element is a native button. Default: `false` |
| `inset?`           | `boolean`                                                                          |                                                                                                                                                                               |

### DropdownMenuRadioGroup

| Prop             | Type                                                                       | Description                                                                                                                                           |
| ---------------- | -------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| `children?`      | `React.ReactNode`                                                          | The content of the component.                                                                                                                         |
| `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. |
| `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.         |
| `onValueChange?` | `((value: any, eventDetails: Menu.RadioGroup.ChangeEventDetails) => void)` | Function called when the selected value changes.                                                                                                      |
| `disabled?`      | `boolean`                                                                  | Whether the component should ignore user interaction. Default: `false`                                                                                |

### DropdownMenuRadioItem

| Prop            | Type                                                                           | Description                                                                                                                                                                   |
| --------------- | ------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `value`         | `any`                                                                          | Value of the radio item. This is the value that will be set in the MenuRadioGroup when the item is selected.                                                                  |
| `onClick?`      | `((event: BaseUIEvent<React.MouseEvent<HTMLDivElement, MouseEvent>>) => void)` | The click handler for the menu item.                                                                                                                                          |
| `disabled?`     | `boolean`                                                                      | Whether the component should ignore user interaction. Default: `false`                                                                                                        |
| `label?`        | `string`                                                                       | Overrides the text used for keyboard text navigation and filtering. Falls back to the rendered text when not provided.                                                        |
| `id?`           | `string`                                                                       |                                                                                                                                                                               |
| `closeOnClick?` | `boolean`                                                                      | Whether to close the menu when the item is clicked. Default: `false`                                                                                                          |
| `nativeButton?` | `boolean`                                                                      | Whether the component renders a native `<button>` element when replacing it via the `render` prop. Set to `true` if the rendered element is a native button. Default: `false` |
| `inset?`        | `boolean`                                                                      |                                                                                                                                                                               |

### DropdownMenuSeparator

| Prop           | Type                         | Description                                               |
| -------------- | ---------------------------- | --------------------------------------------------------- |
| `orientation?` | `"horizontal" \| "vertical"` | The orientation of the separator. Default: `'horizontal'` |
