Use Dropdown for menu actions or persistent menu choices. Use role="menuitem" for actions and explicitly choose role="menuitemradio" for mutually exclusive persistent choices. Use a native select or Combobox for form-value selection; listbox choices keep role="option".
aria-expanded, aria-controls, and aria-haspopup directly as slot props. Bind those three attributes explicitly to the trigger to preserve consumer refs; do not forward the internal ref slot prop. aria-controls refers to the popup element with role="menu".<dt-dropdown navigation-type="arrow-keys"> <template #anchor="anchorAttrs"> <dt-button :aria-expanded="anchorAttrs['aria-expanded']" :aria-controls="anchorAttrs['aria-controls']" :aria-haspopup="anchorAttrs['aria-haspopup']" > Click to open </dt-button> </template> <template #list="{ close }"> <dt-list-item v-for="(item) in items" :key="item.id" role="menuitem" navigation-type="arrow-keys" @click="close" > {{ item.name }} </dt-list-item> </template> </dt-dropdown>
<dt-dropdown navigation-type="arrow-keys"> <template #anchor="anchorAttrs"> <dt-button :aria-expanded="anchorAttrs['aria-expanded']" :aria-controls="anchorAttrs['aria-controls']" :aria-haspopup="anchorAttrs['aria-haspopup']" > Click to open </dt-button> </template> <template #list="{ close }"> <dt-list-item-group heading-class="d-py-50 d-px-100 d-c-default d-fc-tertiary d-label--sm" heading="Menu Heading A" > <dt-list-item role="menuitem" navigation-type="arrow-keys" @click="close" > Menu Item 1 </dt-list-item> <dt-dropdown-separator /> <dt-list-item role="menuitem" navigation-type="arrow-keys" @click="close" > Menu Item 2 </dt-list-item> </dt-list-item-group> <dt-dropdown-separator /> <dt-list-item-group heading-class="d-py-50 d-px-100 d-c-default d-fc-tertiary d-label--sm" heading="Menu Heading B" > <dt-list-item role="menuitem" navigation-type="arrow-keys" @click="close" > Menu Item 3 </dt-list-item> </dt-list-item-group> </template> </dt-dropdown>
Set openOnContext=true to open the menu on right-click (context menu) and disable the default trigger behavior. This example retains an existing context-menu accessibility gap: the focusable wrapper does not receive the popup ARIA attributes.
<dt-dropdown navigation-type="arrow-keys" :open-on-context="true"> <template #anchor> <div class="d-ba d-bas-dashed d-w-400 d-py-600 d-ta-center d-bgc-black-300" > Right click to open </div> </template> <template #list="{ close }"> <dt-list-item v-for="(item) in items" :key="item.id" role="menuitem" navigation-type="arrow-keys" @click="close" > {{ item.name }} </dt-list-item> </template> </dt-dropdown>
Dropdown content renders outside the DOM tree. Use the contentMode prop to apply color mode (invert, light, dark) to the positioned content. See Positioned Components for details.
<dt-dropdown content-mode="invert">...</dt-dropdown> <dt-dropdown content-mode="dark">...</dt-dropdown> <dt-dropdown content-mode="light">...</dt-dropdown>
Menu radio choices require menuitemradio support in both ListItem and Dropdown. Older packages, including @dialpad/dialtone 10.5.1, do not include this API. Check the supported roles in your installed package before adopting this pattern.
The parent owns the committed sort order. Each radio row uses selected for its checkmark and aria-checked; arrows and typeahead move focus without changing that state. ListItemGroup supplies an optional heading inside the menu. Ordinary action rows can share the menu and keep menuitem.
<script setup> import { ref } from 'vue'; import { DtButton, DtDropdown, DtListItem, DtListItemGroup } from '@dialpad/dialtone-vue'; const newestFirst = ref(true); </script> <template> <dt-dropdown> <template #anchor="anchorAttrs"> <dt-button :aria-expanded="anchorAttrs['aria-expanded']" :aria-controls="anchorAttrs['aria-controls']" :aria-haspopup="anchorAttrs['aria-haspopup']" > Sort order </dt-button> </template> <template #list="{ close }"> <dt-list-item-group heading="Sort order"> <dt-list-item role="menuitemradio" navigation-type="arrow-keys" :selected="newestFirst" @click="newestFirst = true; close()" > Newest first </dt-list-item> <dt-list-item role="menuitemradio" navigation-type="arrow-keys" :selected="!newestFirst" @click="newestFirst = false; close()" > Oldest first </dt-list-item> </dt-list-item-group> </template> </dt-dropdown> </template>
Set :visibility-change-callback="handleVisibilityChange" to receive the open boolean synchronously when logical visibility changes, before the animation completes. With initial open=true, the callback runs during creation, before mount; the menu exposes aria-hidden="false". No callback means no logical notification. Dropdown does not declare or emit open-change, preserving existing DOM listeners and wrapper notifications.
The callback runs inside a synchronous Vue watcher. An already-closed modal with no pending transition or retained scroll lock can be removed immediately. For an open or closing modal, keep modal=true, its anchor and its scroll container unchanged through the closing opened(false) notification: request closure if needed, then remove it after that notification. Changing modal or the anchor's scroll context after opening can leave the original lock active. opened(false) reports transition completion, not ownership of global scroll locks. Logical open=false alone does not establish that the leave transition has completed. Separately, defer a direct app.unmount() with nextTick to avoid interrupting Vue's render during prop delivery.
opened and update:open report current completed transitions. Opening finishes initial focus before notifying listeners, so focus chosen by an opened listener is preserved. Stale completions do not notify. open=null emits no update:open.
With a boolean open prop, anchor arrows remain silent by default. Set forwardAnchorArrowKeys to forward ArrowUp/ArrowDown through keydown without automatically toggling. On a closed opted-in Dropdown, the consumer decides whether to open and whether to prevent the key's default action; the event continues to ancestor listeners. To start with focus on the first navigable row, accept opening synchronously in Dropdown's own emitted keydown callback. An ancestor DOM listener or a delayed update does not carry that focus guarantee. The callback also receives content key events, so check that the event target belongs to the anchor before requesting opening; closing-content arrows must not reopen the menu. Ignored arrows do not make a later pointer opening behave like a keyboard opening. Once open, normal Dropdown navigation and key prevention apply.
The list wrapper uses role="none" to preserve the containing menu context. Use explicit menuitem rows for actions and menuitemradio for persistent single choices; listitem and listbox option rows are not Dropdown menu patterns. Hovering headings does not move menu focus or change checked state.
A screen reader visible only close button is added by default.
The dropdown surface has role="menu"; action rows use menuitem and persistent mutually exclusive choices use menuitemradio. See W3C guidelines for more information.
The positioned surface supplies role="menu". Its <ul role="none"> list wrapper adds no implicit list role between that menu and its rows. Use menuitem for actions and menuitemradio for persistent mutually exclusive choices; optional ListItemGroup headings keep their labelled group context. Use List Item for the row interactions.
With navigationType="arrow-keys", UP and DOWN move focus through the application rows and the built-in Close command. Close is the last keyboard destination for both the visually hidden and showCloseButton presentations; its DOM placement stays unchanged. HOME focuses the first row and END focuses Close. By default, moving past either row boundary reaches Close; from Close, UP returns to the last row and DOWN wraps to the first. An empty menu focuses Close. Custom onBeginningOfList and onEndOfList callbacks retain precedence at the application-row boundaries; END still reaches Close. A-Z typeahead continues to cycle through application rows.
Keyboard opening starts on the first application row, or Close when there are no rows. The built-in visually hidden Close becomes visible while keyboard-focused in an arrow-key menu and hides again when focus leaves. ESC closes the menu and returns focus to the trigger. ENTER and SPACE activate the focused command. Focusing Close does not emit an application-row highlight index or activate a row; existing row indexes and checked choices stay unchanged. Dismissal still clears the highlight with -1.
The shared keyboard-navigation mixin accepts a string or array of roles through listItemRole; its default remains option. Dropdown collects menuitem and menuitemradio in document order. Built-in ListItem IDs are generated and remain stable. Use li rows for pointer-driven Dropdown navigation. A hand-authored menuitemradio must have a nonempty unique ID to participate; id-less radio rows are excluded. Non-li rows retain their existing pointer behavior: hover does not transfer menu focus or emit highlight. Headings and separators stay outside the navigable collection. Hovering an ID-bearing group heading clears the navigation highlight and emits highlight(-1) without moving focus or changing the checked choice. Direct calls to the exported mixin's setHighlightId retain legacy behavior: a nonempty ID is stored even before its row renders; an unmatched ID in a rendered collection clears the highlighted index.
import { DtDropdown, DtDropdownSeparator } from '@dialpad/dialtone-vue';
Name
|
Type
|
|---|---|
anchor | Dropdown trigger. Bind the three ARIA slot props individually to the trigger to preserve consumer refs. |
footer | Slot for the footer content |
list | Slot for the list component |
Name
|
Default
|
Type
|
|---|---|---|
appendTo | 'body' |
"'body'"
|
"'parent'"
|
"'root'"
|
"HTMLElement"
|
""
Sets the element to which the popover is going to append to.
'body' will append to the nearest body (supports shadow DOM). |
contentMode |
"light"
|
"dark"
|
"invert"
Applies a color mode to the positioned content element. | |
contentWidth | null |
"null"
|
"anchor"
Width configuration for the popover content. When its value is 'anchor',
the popover content will have the same width as the anchor. |
fallbackPlacements | ['auto'] |
"top"
|
"top-start"
|
"top-end"
|
"right"
|
"right-start"
|
"right-end"
|
"left"
|
"left-start"
|
"left-end"
|
"bottom"
|
"bottom-start"
|
"bottom-end"
|
"auto"
|
"auto-start"
|
"auto-end"
If the dropdown does not fit in the direction described by "placement",
it will attempt to change it's direction to the "fallbackPlacements". |
footerClass | '' | string|array|object Additional class for the footer wrapper element. |
forwardAnchorArrowKeys | false |
"true"
|
"false"
Forwards anchor ArrowUp/ArrowDown with a boolean open prop without toggling.
Closed anchor arrows retain their default action and propagation for consumer handling.
Accept opening synchronously in the emitted keydown callback for first-row focus. |
listClass | '' | string|array|object Additional class for the wrapper list element. |
listId | generated unique ID | string Sets an ID on the list element of the component. Used by several aria attributes
as well as when deriving the IDs for each item. |
maxHeight | '' | string Determines maximum height for the popover before overflow.
Possible units rem|px|em |
maxWidth | '' | string Determines maximum width for the popover before overflow.
Possible units rem|px|%|em |
modal | true | boolean Determines modal state, dropdown has a modal overlay preventing interaction with elements
below it, but it is invisible. |
navigationType | arrow-keys |
"arrow-keys"
|
"tab"
|
"none"
The type of navigation that this component should support. |
onBeginningOfList | null | func A method that will be called when the selection goes past the beginning of the list. |
onEndOfList | null | func A method that will be called when the selection goes past the end of the list. |
open | null |
"null"
|
"true"
|
"false"
Controls whether the dropdown is shown. When null (default), the dropdown
toggles on click. When set to true or false, the default trigger is
disabled and the parent controls visibility via v-model:open. |
openOnContext | false | boolean Opens the dropdown on right click (context menu). If you set this value to |
padding | 'small' |
"none"
|
"small"
|
"large"
Vertical padding size around the list element. |
placement | 'bottom' |
"top"
|
"top-start"
|
"top-end"
|
"right"
|
"right-start"
|
"right-end"
|
"left"
|
"left-start"
|
"left-end"
|
"bottom"
|
"bottom-start"
|
"bottom-end"
|
"auto"
|
"auto-start"
|
"auto-end"
The direction the dropdown displays relative to the anchor. |
tether | true |
"true"
|
"false"
If set to false the dialog will display over top of the anchor when there is insufficient space.
If set to true it will never move from its position relative to the anchor and will clip instead.
Popper.js docs
|
transition | 'fade' | string Named transition when the content display is toggled. |
visibilityChangeCallback | null | func Optional callback receiving the open boolean synchronously on logical visibility changes.
Includes initial true during creation, before mount, when open=true.
Does not declare or emit an open-change event.
For modal removal, keep modal=true, its anchor and scroll container unchanged until opened(false).
Changing modal or the anchor's scroll context after opening can retain the original lock.
opened(false) reports transition completion, not global scroll-lock ownership.
A closed modal with no pending transition or retained scroll lock can be removed immediately.
Defer direct app.unmount() until Vue's next tick. |
Name
|
Type
|
|---|---|
highlight | Number Event fired when the highlight changes |
keydown | KeyboardEvent Native keydown event |
opened | Boolean | Array Event fired after the current transition and initial focus work complete |
update:open | undefined Event fired to sync the open prop with the parent component |
Dropdown documentation last updated Friday, November 13, 2026