# Dropdown Menu

## Usage

`DropdownMenu` turns a button into the entry point for a small set of actions. The button stays quiet; the menu appears next to it when opened, closes as soon as an action is picked, and gives focus back to the button. It is the right shape for "what do I do next" — rename, duplicate, archive, delete — when the actions are one flat level deep.

The shortest form is an `items` array, where each entry is one action:

```vue
<script setup lang="ts">
import { DropdownMenu } from '@astryx-vue/core/DropdownMenu'
</script>

<template>
  <DropdownMenu
    :button="{ label: 'Actions' }"
    :items="[
      { label: 'Edit project', icon: 'i-carbon-tools', onClick: () => edit() },
      { label: 'Duplicate project', icon: 'i-carbon-copy', onClick: () => duplicate() },
      { label: 'Delete project', icon: 'i-carbon-trash-can', variant: 'destructive', onClick: () => remove() },
    ]"
  />
</template>
```

An entry can be an action, a divider, a titled group, a checkbox row, or a radio group. An action says what happens next. A checkbox row carries whether it is on. A radio group carries the selected value and lists its options. Those rows are also documented on their own pages: [Dropdown Menu Checkbox Item](/en/components/dropdown-menu-checkbox-item), [Dropdown Menu Radio Group](/en/components/dropdown-menu-radio-group), and [Dropdown Menu Radio Item](/en/components/dropdown-menu-radio-item). When the rows follow page state, or you want to lay them out yourself, use the default slot and the matching row components. Both forms draw the same structure. In a template, put the built-in icon in the icon slot and pass its name. In the data array, pass an icon component or a CSS icon class.

The trigger is the design system's `Button` by default. Pass its props through `button` (`variant`, `size`, `isIconOnly`, …); `size` also sets the height of the menu rows, so a `size="sm"` button goes with a compact menu. When the trigger is not a plain button — an icon button, an avatar, a row in a list — use the `trigger` slot instead and `v-bind` everything the slot hands you onto your own control. The menu then hangs off that control and takes its name from it.

```vue
<template>
  <DropdownMenu>
    <template #trigger="triggerProps">
      <IconButton v-bind="triggerProps" icon="i-carbon-overflow-menu-horizontal" label="More actions" />
    </template>

    <DropdownMenuItem icon="i-carbon-tools" label="Edit project" @click="edit" />
  </DropdownMenu>
</template>
```

Once open, the menu owns the keyboard. The arrow keys move between rows and wrap at both ends, `Home` and `End` jump to the first and last row, `PageUp` and `PageDown` page through a long menu, and typing a letter jumps to the next row that starts with it (pressing the same letter again cycles through the matches). `Enter` and Space run the highlighted row, `Escape` or a press outside closes the menu and returns focus to the trigger, and `Tab` closes the menu as well so the browser keeps its own tab order. Moving the pointer over a row moves focus to it, so keyboard and pointer share one highlight and two rows are never lit at once.

Where the menu opens differs by how it was opened. A keyboard open puts focus on the first row (or the last one for `ArrowUp`); a pointer open only focuses the menu itself, so no row reads as already selected.

The panel places itself: it opens below the trigger, aligned to its start, and flips to the other side when there is no room — `placement` and `alignment` select among above/below/start/end and start/center/end. The width matches the trigger up to a 320px cap, or follows `menuWidth` (a length, or an intrinsic keyword such as `max-content`). The height is capped at 300px and scrolls past that; `menuMaxHeight` raises the cap in pixels for a menu that must fit all of its rows.

Use a two-way binding on the open state when something outside the menu drives it. A menu that is mounted already open does not move focus — nobody asked for that open, and pulling focus out of the page loses the user's place.

A checkbox row toggles one view setting. Activating it flips the state and leaves the menu open, so several settings can change in one visit. Radio rows belong in a radio group, and only one of them can be selected. Choosing one closes the menu, because the choice is made. Arrow keys still move across these rows, and Space or Enter toggles the highlighted one. A disabled row stays in the menu, but the arrows skip it and a click does not change it. The check mark and the radio dot are decorative; the whole row is the control. On a coarse pointer the mark moves to the end of the row.

Content that is not an option can sit above or below the rows: a filter field, or a button that creates something. The popover is then a modal dialog, and the trigger's `aria-haspopup` is `dialog`. Tab cycles the header, the menu as one stop, and the footer, wrapping at both ends, and the menu stays open. Typing in the header does not jump to a row by its first letter. Shift+Tab from a row lands on the last focusable control in the header. Without a header or a footer, Tab still closes the menu. A pointer open does not paint a focus ring on the menu; the ring appears once keyboard focus later returns to the trigger.

A submenu flies out beside its row on a wide screen. On a compact touch surface the next level replaces the current rows and adds a Back row at the top, named after the parent. That choice is made when the menu opens and does not change while it stays open. A submenu can also be forced to always fly out, or always replace the rows. While its children are still loading, the caret can become a spinner, and the submenu can still be opened. A flyout is at least about 160 pixels wide unless a width is set, and it never grows past the viewport.

### Anatomy

- **Trigger button**: Button that opens and closes the selected menu presentation.
- **Trigger indicator icon**: Optional trailing chevron shown by a labeled trigger when hasChevron is enabled.
- **Pointer menu surface**: Anchored top-level or nested menu panel used by the pointer presentation.
- **Pointer action row**: Action, selectable option, or submenu trigger row in an anchored menu.
- **Icon-rendered item icon**: Optional semantic or component icon rendered through Icon at the start of an action row.
- **Caller-rendered item start content**: Optional arbitrary slot content rendered directly at the start of an action row.
- **Checkbox indicator**: Decorative shared checkbox indicator for a checkbox action row.
- **Radio indicator**: Decorative shared radio indicator with an additional menu-owned target.
- **Pointer section heading**: Heading that labels a group of rows in an anchored menu: a data-driven section or a compound DropdownMenuGroup.
- **Pointer divider**: Divider between groups in an anchored menu.
- **Pointer submenu indicator icon**: Trailing chevron that identifies an action row as a nested flyout trigger.
- **Touch sheet frame**: BottomSheet panel, content area, handle, and optional scrim that host touch actions.
- **Touch menu surface**: Menu-owned content panel rendered inside the touch sheet frame.
- **Touch heading**: Current action-sheet title, updated when a nested action view is opened.
- **Touch action list**: Spacious List that groups actions in the touch presentation.
- **Touch action row**: ListItem button used for an action or drill-in entry in the touch presentation.
- **Touch divider**: Divider between action groups in the touch presentation.

## Best practices

| Guidance | Practices |
| --- | --- |
| Do | Write row labels as short verb phrases, so one glance tells the user what the row does. |
| Do | Use groups and dividers to cluster related actions once a menu grows past five or six rows. |
| Do | Mark dangerous rows with `variant="destructive"` and keep them near the bottom of the menu. |
| Do | Put a shortcut hint in the `endContent` slot, usually a `Kbd`, instead of spelling the keys into the label. |
| Do | Use checkbox rows for view toggles and leave the menu open. Use a radio group for one choice among several, and let it close. |
| Do | Put a filter or a create action above or below the rows, not inside the list of options. |
| Do | Spread the whole trigger-slot object onto a custom control. Taking only part of it drops the expanded state or the control relationship, and a screen reader then cannot tell whether the menu is open. |
| Don't | Use a dropdown menu for navigation. A menu performs an action; navigation belongs to a navigation component. |
| Don't | Put a dozen rows in one menu without grouping them. Nobody finds anything, and the later options go unread. |
| Don't | Use the menu as a form. Anything that needs typing or multiple choices belongs in a dialog or a dedicated control. |

## Examples

### Actions

An action menu with a divider between everyday actions and destructive ones. Picking a row reports the last action.

```vue
<script setup lang="ts">
import { DropdownMenu } from '@astryx-vue/core/DropdownMenu'
import { VStack } from '@astryx-vue/core/Stack'
import { Text } from '@astryx-vue/core/Text'
import { ref } from 'vue'

const lastAction = ref<string | null>(null)

function run(action: string) {
  lastAction.value = action
}
</script>

<template>
  <VStack :gap="3">
    <DropdownMenu
      :button="{ label: 'Actions' }"
      :items="[
        { label: 'Edit', onClick: () => run('Edit') },
        { label: 'Duplicate', onClick: () => run('Duplicate') },
        { label: 'Move to folder', onClick: () => run('Move') },
        { type: 'divider' },
        { label: 'Archive', onClick: () => run('Archive') },
        { label: 'Delete', onClick: () => run('Delete') },
      ]"
    />
    <Text v-if="lastAction" type="supporting" color="secondary">
      Last action: {{ lastAction }}
    </Text>
  </VStack>
</template>
```

### Adaptive presentation

A compact touch surface opens a bottom sheet. Everywhere else the menu stays anchored to the button.

```vue
<script setup lang="ts">
import { DropdownMenu } from '@astryx-vue/core/DropdownMenu'
import { VStack } from '@astryx-vue/core/Stack'
import { Text } from '@astryx-vue/core/Text'
import { ref } from 'vue'

const lastAction = ref<string | null>(null)

function run(action: string) {
  lastAction.value = action
}

const actions = [
  { label: 'Edit project', icon: 'css-icon css-icon--sm i-carbon-edit' },
  { label: 'Duplicate project', icon: 'css-icon css-icon--sm i-carbon-copy' },
  { label: 'Share project', icon: 'css-icon css-icon--sm i-carbon-share' },
  { label: 'Archive project', icon: 'css-icon css-icon--sm i-carbon-archive' },
].map(action => ({
  label: action.label,
  icon: action.icon,
  onClick: () => run(action.label),
}))
</script>

<template>
  <VStack :gap="3">
    <DropdownMenu
      :button="{ label: 'Project actions' }"
      presentation="adaptive"
      :items="actions"
    />
    <Text v-if="lastAction" type="supporting" color="secondary">
      Last action: {{ lastAction }}
    </Text>
  </VStack>
</template>
```

### Disabled

Some rows stay disabled when the current user cannot run them.

```vue
<script setup lang="ts">
import { DropdownMenu } from '@astryx-vue/core/DropdownMenu'
import { VStack } from '@astryx-vue/core/Stack'
import { Text } from '@astryx-vue/core/Text'
import { ref } from 'vue'

const lastAction = ref<string | null>(null)

function run(action: string) {
  lastAction.value = action
}
</script>

<template>
  <VStack :gap="3">
    <DropdownMenu
      :button="{ label: 'Manage team' }"
      :items="[
        { label: 'Invite member', onClick: () => run('Invite') },
        { label: 'Edit roles', onClick: () => run('Edit roles') },
        { type: 'divider' },
        { label: 'Transfer ownership', isDisabled: true },
        { label: 'Delete team', isDisabled: true },
      ]"
    />
    <Text v-if="lastAction" type="supporting" color="secondary">
      Last action: {{ lastAction }}
    </Text>
    <Text type="supporting" color="secondary">
      Destructive actions are disabled for non-admin users
    </Text>
  </VStack>
</template>
```

### Icon trigger

An icon-only button opens the menu, with no chevron and no label on the trigger.

```vue
<script setup lang="ts">
import { DropdownMenu, DropdownMenuDivider, DropdownMenuItem } from '@astryx-vue/core/DropdownMenu'
import { Icon } from '@astryx-vue/core/Icon'
import { IconButton } from '@astryx-vue/core/IconButton'
import { VStack } from '@astryx-vue/core/Stack'
import { Text } from '@astryx-vue/core/Text'
import { ref } from 'vue'

const lastAction = ref<string | null>(null)
</script>

<template>
  <VStack :gap="3">
    <DropdownMenu>
      <template #trigger="triggerProps">
        <IconButton v-bind="triggerProps" label="More actions" variant="ghost">
          <Icon icon="moreHorizontal" />
        </IconButton>
      </template>
      <DropdownMenuItem label="Copy link" @click="lastAction = 'Copy link'" />
      <DropdownMenuItem label="Download" @click="lastAction = 'Download'" />
      <DropdownMenuItem label="Print" @click="lastAction = 'Print'" />
      <DropdownMenuDivider />
      <DropdownMenuItem label="Report" @click="lastAction = 'Report'" />
    </DropdownMenu>
    <Text v-if="lastAction" type="supporting" color="secondary">
      Last action: {{ lastAction }}
    </Text>
  </VStack>
</template>
```

### Sections

Titled sections group the rows, so a longer menu stays easy to scan.

```vue
<script setup lang="ts">
import { DropdownMenu } from '@astryx-vue/core/DropdownMenu'
import { VStack } from '@astryx-vue/core/Stack'
import { Text } from '@astryx-vue/core/Text'
import { ref } from 'vue'

const lastAction = ref<string | null>(null)

function run(action: string) {
  lastAction.value = action
}
</script>

<template>
  <VStack :gap="3">
    <DropdownMenu
      :button="{ label: 'File', variant: 'ghost' }"
      :items="[
        {
          type: 'section',
          title: 'Create',
          items: [
            { label: 'New document', onClick: () => run('New document') },
            { label: 'New spreadsheet', onClick: () => run('New spreadsheet') },
            { label: 'New folder', onClick: () => run('New folder') },
          ],
        },
        {
          type: 'section',
          title: 'Manage',
          items: [
            { label: 'Share', onClick: () => run('Share') },
            { label: 'Move', onClick: () => run('Move') },
            { label: 'Archive', onClick: () => run('Archive') },
          ],
        },
      ]"
    />
    <Text v-if="lastAction" type="supporting" color="secondary">
      Selected: {{ lastAction }}
    </Text>
  </VStack>
</template>
```

### Submenu

Hover or the Right arrow opens the flyout. Left arrow or Escape closes it and returns to the parent row.

```vue
<script setup lang="ts">
import { DropdownMenu, DropdownMenuItem, DropdownMenuSubMenu } from '@astryx-vue/core/DropdownMenu'
import { VStack } from '@astryx-vue/core/Stack'
import { Text } from '@astryx-vue/core/Text'
import { ref } from 'vue'

const lastAction = ref<string | null>(null)
</script>

<template>
  <VStack :gap="3">
    <DropdownMenu :button="{ label: 'Actions' }">
      <DropdownMenuItem label="Rename" @click="lastAction = 'Rename'" />
      <DropdownMenuSubMenu label="Move to">
        <DropdownMenuItem label="Projects" @click="lastAction = 'Move to Projects'" />
        <DropdownMenuItem label="Archive" @click="lastAction = 'Move to Archive'" />
        <DropdownMenuItem label="Trash" @click="lastAction = 'Move to Trash'" />
      </DropdownMenuSubMenu>
      <DropdownMenuItem label="Delete" @click="lastAction = 'Delete'" />
    </DropdownMenu>
    <Text v-if="lastAction" type="supporting" color="secondary">
      Last action: {{ lastAction }}
    </Text>
  </VStack>
</template>
```

### Checkbox and radio

Checkbox rows leave the menu open so several settings can change together. Choosing a sort order closes the menu and updates the summary.

```vue
<script setup lang="ts">
import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuDivider, DropdownMenuRadioGroup, DropdownMenuRadioItem } from '@astryx-vue/core/DropdownMenu'
import { Icon } from '@astryx-vue/core/Icon'
import { VStack } from '@astryx-vue/core/Stack'
import { Text } from '@astryx-vue/core/Text'
import { ref } from 'vue'

const showArchived = ref(false)
const compact = ref(true)
const sort = ref('updated')
</script>

<template>
  <VStack :gap="3">
    <DropdownMenu :button="{ label: 'View' }">
      <DropdownMenuCheckboxItem v-model="showArchived" label="Show archived">
        <template #icon>
          <Icon name="carbon:archive" />
        </template>
      </DropdownMenuCheckboxItem>
      <DropdownMenuCheckboxItem v-model="compact" label="Compact rows">
        <template #icon>
          <Icon name="carbon:list" />
        </template>
      </DropdownMenuCheckboxItem>
      <DropdownMenuDivider />
      <DropdownMenuRadioGroup v-model="sort" label="Sort by">
        <DropdownMenuRadioItem value="name" label="Name">
          <template #icon>
            <Icon name="carbon:sort-ascending" />
          </template>
        </DropdownMenuRadioItem>
        <DropdownMenuRadioItem value="updated" label="Last updated">
          <template #icon>
            <Icon name="carbon:time" />
          </template>
        </DropdownMenuRadioItem>
        <DropdownMenuRadioItem value="created" label="Created">
          <template #icon>
            <Icon name="carbon:calendar" />
          </template>
        </DropdownMenuRadioItem>
      </DropdownMenuRadioGroup>
    </DropdownMenu>
    <Text v-if="sort" color="secondary" type="supporting">
      {{ compact ? 'Compact' : 'Comfortable' }} · {{ showArchived ? 'Including archived' : 'Active only' }} · Sorted by {{ sort }}
    </Text>
  </VStack>
</template>
```

### Header and footer

The filter sits above the rows and the create button sits below. Typing in the filter narrows the labels and does not jump to a row.

```vue
<script setup lang="ts">
import { Button } from '@astryx-vue/core/Button'
import { DropdownMenu, DropdownMenuItem } from '@astryx-vue/core/DropdownMenu'
import { Icon } from '@astryx-vue/core/Icon'
import { TextInput } from '@astryx-vue/core/TextInput'
import { computed, ref } from 'vue'

const query = ref('')
const labels = ref(['Bug', 'Design', 'Docs'])

const visible = computed(() => labels.value.filter(label => label.toLowerCase().includes(query.value.trim().toLowerCase())))

function createLabel(): void {
  const name = query.value.trim()
  if (name === '' || labels.value.includes(name))
    return
  labels.value = [...labels.value, name]
  query.value = ''
}
</script>

<template>
  <DropdownMenu :button="{ label: 'Labels' }" menu-width="240px">
    <template #header>
      <TextInput v-model="query" label="Filter labels" placeholder="Filter" size="sm" />
    </template>
    <DropdownMenuItem v-for="label in visible" :key="label" :label="label">
      <template #icon>
        <Icon name="carbon:tag" />
      </template>
    </DropdownMenuItem>
    <DropdownMenuItem v-if="visible.length === 0" is-disabled label="No matches" />
    <template #footer>
      <Button label="Create label" variant="ghost" @click="createLabel">
        <template #icon>
          <Icon name="carbon:add" />
        </template>
      </Button>
    </template>
  </DropdownMenu>
</template>
```

### Drill-in and loading

Move to replaces the current rows and adds a Back row. Share is still loading, so its caret is a spinner.

```vue
<script setup lang="ts">
import { DropdownMenu, DropdownMenuItem, DropdownMenuSubMenu } from '@astryx-vue/core/DropdownMenu'
import { Icon } from '@astryx-vue/core/Icon'
import { VStack } from '@astryx-vue/core/Stack'
import { Text } from '@astryx-vue/core/Text'
import { ref } from 'vue'

const lastAction = ref<string | null>(null)
</script>

<template>
  <VStack :gap="3">
    <DropdownMenu :button="{ label: 'Actions' }">
      <DropdownMenuItem label="Rename" @click="lastAction = 'Rename'">
        <template #icon>
          <Icon name="carbon:edit" />
        </template>
      </DropdownMenuItem>
      <DropdownMenuSubMenu label="Move to" presentation="drill-in">
        <template #icon>
          <Icon name="carbon:folder-move-to" />
        </template>
        <DropdownMenuItem label="Projects" @click="lastAction = 'Projects'" />
        <DropdownMenuItem label="Archive" @click="lastAction = 'Archive'" />
      </DropdownMenuSubMenu>
      <DropdownMenuSubMenu has-spinner label="Share" menu-width="220px">
        <template #icon>
          <Icon name="carbon:share" />
        </template>
        <DropdownMenuItem is-disabled label="Loading destinations" />
      </DropdownMenuSubMenu>
    </DropdownMenu>
    <Text v-if="lastAction" color="secondary" type="supporting">
      Last action: {{ lastAction }}
    </Text>
  </VStack>
</template>
```

## Props

### DropdownMenu

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `button` | `DropdownMenuButtonProps` | the active locale (`{ label: 'Menu' }` in English) | Props for the trigger button — every `Button` prop except `clickAction`, which would compete with the menu for the same click. `size` also sets the height of the menu rows. |
| `items` | `DropdownMenuOption[]` | - | Data-mode menu content. Each entry is an action, a divider, a titled group, a checkbox row (`type: 'checkbox'`, with `checked` and `onChange`), or a radio group (`type: 'radio'`, with `value`, `label`, `items`, and `onChange`). Mutually exclusive with the default slot; `items` wins when both are given. |
| `isMenuOpen` | `boolean` | - | Controlled open state, paired with `v-model:is-menu-open`. Left out, the menu manages its own state. A menu mounted already open does not move focus. |
| `menuWidth` | `number \| string` | - | Minimum width of the menu. A length grows for its content; an intrinsic keyword such as `max-content` becomes the preferred width. Every form is capped to the viewport. Defaults to the trigger's width, capped at 320px. |
| `menuMaxHeight` | `number` | - | Maximum height in pixels, for a menu that must fit all of its rows. This lifts the default 300px cap; the viewport still bounds the real height. |
| `placement` | `'above' \| 'below' \| 'start' \| 'end'` | `'below'` | Where the menu opens relative to the trigger. It flips to the opposite side when there is no room. |
| `alignment` | `'start' \| 'center' \| 'end'` | `'start'` | How the menu aligns with the trigger along the placement axis. |
| `hasChevron` | `boolean` | `true` | Whether the trigger button shows a trailing chevron. An icon-only button never shows it. |

### DropdownMenuItem

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `label` | `string \| number` | - | Primary text of the row. Use the `label` slot for rich content. |
| `description` | `string \| number` | - | Secondary line below the label. Use the `description` slot for rich content. |
| `icon` | `string \| Component` | - | Icon before the label: a CSS icon class (an UnoCSS class such as `i-carbon-copy`, or one of your own), or a component that draws the SVG. astryx-vue ships no icons. Use the `icon` slot for arbitrary content. |
| `isDisabled` | `boolean` | `false` | Disables the row. A disabled row is skipped by the arrow keys and by typeahead, and it does not respond to clicks. |
| `variant` | `'default' \| 'destructive'` | `'default'` | Visual variant. `destructive` recolors the label, description, and icon in the error color for dangerous actions such as Delete. The hover highlight stays the shared neutral, so it still matches every other row. |
| `hasCloseOnSelect` | `boolean` | `true` | Whether activating the row closes the menu. Set it to `false` for an action that reports its result on the row itself, such as a copy row. |
| `href` | `string` | - | Address the row navigates to. The row then renders as one anchor carrying `role="menuitem"`, so a ⌘/Ctrl-click and a middle click keep the browser's meaning. |
| `target` | `'_blank' \| '_self'` | - | Link target. Only used with `href`. |
| `rel` | `string` | - | Link relationship. Only used with `href`. `noopener` and `noreferrer` are added for `target="_blank"`. |
| `onClick` | `(event: MouseEvent) => void` | - | Called when the row is activated. On a link row it runs before the browser navigates, and it is skipped for a modified click, which the browser owns. |

### DropdownMenuGroup

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `title` | `string \| number` | - | Heading shown above the group's rows and used as the group's accessible name. Omit it for an unnamed group. |

`DropdownMenuDivider` takes no props. It renders a separator, so it is never a stop in the arrow-key order.

### DropdownMenuCheckboxItem

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `modelValue` | `boolean` | - | Whether the row is checked. Pair it with `v-model`. The data array uses `checked` instead. |
| `label` | `string \| number` | - | Primary text. Use the `label` slot for rich content. |
| `description` | `string \| number` | - | Secondary line under the label. |
| `icon` | `string \| Component` | - | Icon before the label: a CSS icon class, or a component that draws one. Use the `icon` slot for anything else. The examples use the built-in icon component. |
| `isDisabled` | `boolean` | `false` | Disables the row. It stays in the accessibility tree, the arrows skip it, and a click does not toggle it. |
| `hasCloseOnSelect` | `boolean` | `false` | Whether toggling closes the menu. Checkbox rows stay open. |

The row's role is <code>menuitemcheckbox</code>, and the checked state is <code>aria-checked</code>. The mark is decorative and does not take the click.

### DropdownMenuRadioGroup

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `modelValue` | `string` | - | The selected value. Pair it with `v-model`. Leave it unset when nothing is selected yet. The data array uses `value` as well. |
| `label` | `string` | - | Accessible name of the group, so the options are announced as one set. |
| `hasCloseOnSelect` | `boolean` | `true` | Whether choosing a value closes the menu. A radio group closes. |

### DropdownMenuRadioItem

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `value` | `string` | - | The value this option represents. The item must sit inside a radio group; otherwise it throws while it is set up. |
| `label` | `string \| number` | - | Primary text. |
| `description` | `string \| number` | - | Secondary line under the label. |
| `icon` | `string \| Component` | - | Icon before the label. Use the `icon` slot for anything else. |
| `isDisabled` | `boolean` | `false` | Disables this option. It stays in the group and cannot be selected. |

The row's role is <code>menuitemradio</code>.

### DropdownMenuSubMenu

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `label` | `string \| number` | - | The row's text, and the parent name used by the Back row of the next level. |
| `description` | `string \| number` | - | Secondary line under the label. |
| `icon` | `string \| Component` | - | Icon before the label. |
| `isDisabled` | `boolean` | `false` | The row cannot open the next level. |
| `hasSpinner` | `boolean` | `false` | Replaces the caret with a spinner while the next level is loading. The spinner is decorative and does not block opening. |
| `menuWidth` | `number \| string` | - | Width of the flyout. A number is pixels, used as a minimum and capped to the viewport. An intrinsic keyword becomes the preferred width. Unused while drilled in. |
| `presentation` | `'flyout' \| 'drill-in' \| 'adaptive'` | `'adaptive'` | How the next level appears: beside the row, in place of the current rows, or chosen when the menu opens from whether the surface is a compact touch screen. |

## Events

| Name | Payload | Description |
| --- | --- | --- |
| `update:isMenuOpen` | `boolean` | The open state changed; drives `v-model:is-menu-open`. |
| `openChange` | `boolean` | Fired together with `update:isMenuOpen` when the open state changes. |
| `click` | - | Fired when the trigger is activated, for both opening and closing. |
| `click` (`DropdownMenuItem`) | `MouseEvent` | Fired when the row is activated. |
| `update:modelValue` / `change` (checkbox row, radio group) | `boolean` or `string` | The selection changed. A checkbox row reports the next boolean; a radio group reports the next string. `v-model` listens to `update:modelValue`. |
| `openChange` (`DropdownMenuSubMenu`) | `boolean` | Fired when the flyout or the drilled view opens or closes. |

## Slots

| Name | Description |
| --- | --- |
| `default` | Menu content written by hand: action rows, checkbox rows, radio groups, groups, dividers, and submenus. Mutually exclusive with `items`. |
| `trigger` | A custom control for the trigger. The slot props carry `id`, `aria-haspopup`, `aria-expanded`, `aria-controls`, `onClick` and `onKeyDown`; spread all of them onto the control. |
| `icon` (`DropdownMenuItem`) | Arbitrary leading content, replacing the `icon` prop. |
| `label` / `description` (`DropdownMenuItem`) | Rich content replacing the prop of the same name. |
| `endContent` (`DropdownMenuItem`) | Trailing content, such as a `Kbd` shortcut hint. |
| `title` / `default` (`DropdownMenuGroup`) | A rich heading for the group, and the group's rows. |
| `header` | Content above the rows and outside the menu, such as a filter. Typing there does not move by letter. |
| `footer` | Content below the rows and outside the menu, such as a create button. |
| `icon` / `label` / `description` / `endContent` (checkbox and radio rows) | The same rich-content positions as an action row. The check mark and radio dot are drawn by the row and do not use these slots. |
| `default` (radio group, submenu) | Radio options inside a group, or the next level's rows inside a submenu. |

## Native attributes

Apart from the props above, native attributes fall through to the menu panel element:

- HTML and <code>data-*</code> attributes.
- <code>aria-*</code> attributes.
- <code>class</code> and <code>style</code>.

The panel carries a generated <code>id</code> that the trigger's <code>aria-controls</code> points at. Passing <code>id</code> explicitly replaces both that generated id and the value of <code>aria-controls</code>, so the two cannot drift apart. Passing <code>aria-label</code> or <code>aria-labelledby</code> overrides the menu's default name, which comes from the trigger button's label, or from the control itself when the <code>trigger</code> slot is used.

The trigger button carries <code>aria-haspopup="menu"</code>, <code>aria-expanded</code> and <code>aria-controls</code>. It sits inside a <code>span.astryx-dropdown-menu-trigger</code> that anchors the panel.
