Props
| 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. |
| 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. |
| 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.
| 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 menuitemcheckbox, and the checked state is aria-checked. The mark is decorative and does not take the click.
| 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. |
| 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 menuitemradio.
| 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
data-* attributes. aria-* attributes.class and style.
The panel carries a generated id that the trigger's aria-controls points at. Passing id explicitly replaces both that generated id and the value of aria-controls, so the two cannot drift apart. Passing aria-label or aria-labelledby overrides the menu's default name, which comes from the trigger button's label, or from the control itself when the trigger slot is used.
The trigger button carries aria-haspopup="menu", aria-expanded and aria-controls. It sits inside a span.astryx-dropdown-menu-trigger that anchors the panel.