Row actions
Offer several commands without crowding each row.
Components / Overlays
A keyboard accessible list of actions.
Last changed in version 0.14.2: Improve keyboard navigation, action feedback, and selected colors across Vue components.
To try the safe triangle, hover More actions and move diagonally across Export toward Move workspace. Move straight down onto Export to switch submenus.
bunx --bun @getweini/cli@latest add dropdown-menuImport the files copied by the install command, then place the component in your Vue template. The text and values in the example belong to your app; change them to fit your task.
<script setup lang="ts">
import { ref } from 'vue'
import DropdownMenu from './components/ui/dropdown-menu/DropdownMenu.vue'
import DropdownMenuContent from './components/ui/dropdown-menu/DropdownMenuContent.vue'
import DropdownMenuItem from './components/ui/dropdown-menu/DropdownMenuItem.vue'
import DropdownMenuTrigger from './components/ui/dropdown-menu/DropdownMenuTrigger.vue'
const selected = ref('')
</script>
<template>
<DropdownMenu @select="selected = $event.id">
<DropdownMenuTrigger>Project actions</DropdownMenuTrigger>
<DropdownMenuContent aria-label="Project actions">
<DropdownMenuItem id="rename" label="Rename">Rename</DropdownMenuItem>
<DropdownMenuItem id="archive" label="Archive" destructive>Archive</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
<p v-if="selected">Chosen action:{{ selected }}</p>
</template>DropdownMenuContent points to its trigger with the shared floating surface and 12px gap. Items, checkbox/radio choices, groups, and nested submenus share roving focus, typeahead, RTL-aware arrows, and layer-local Escape handling.
Offer several commands without crowding each row.
Use checkbox items for menu choices that stay selected after the menu closes.
A selected item emits its ID to application code.
<script setup lang="ts">
import DropdownMenu from './components/ui/dropdown-menu/DropdownMenu.vue'
import DropdownMenuContent from './components/ui/dropdown-menu/DropdownMenuContent.vue'
import DropdownMenuItem from './components/ui/dropdown-menu/DropdownMenuItem.vue'
import DropdownMenuSeparator from './components/ui/dropdown-menu/DropdownMenuSeparator.vue'
import DropdownMenuTrigger from './components/ui/dropdown-menu/DropdownMenuTrigger.vue'
</script>
<template>
<DropdownMenu @select="$emit('action', $event.id)">
<DropdownMenuTrigger>Project actions</DropdownMenuTrigger>
<DropdownMenuContent aria-label="Project actions">
<DropdownMenuItem id="rename" label="Rename">Rename</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuItem id="archive" label="Archive" destructive>Archive</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
</template>The checked model remains in application state.
<script setup lang="ts">
import { ref } from 'vue'
import DropdownMenu from './components/ui/dropdown-menu/DropdownMenu.vue'
import DropdownMenuCheckboxItem from './components/ui/dropdown-menu/DropdownMenuCheckboxItem.vue'
import DropdownMenuContent from './components/ui/dropdown-menu/DropdownMenuContent.vue'
import DropdownMenuTrigger from './components/ui/dropdown-menu/DropdownMenuTrigger.vue'
const showArchived = ref(false)
</script>
<template>
<DropdownMenu>
<DropdownMenuTrigger>Display options</DropdownMenuTrigger>
<DropdownMenuContent aria-label="Display options">
<DropdownMenuCheckboxItem id="archived" label="Show archived" v-model:checked="showArchived">
Show archived
</DropdownMenuCheckboxItem>
</DropdownMenuContent>
</DropdownMenu>
</template>Every public prop, model, event, slot, and exposed member of the installed Vue parts is listed below. “Not set” means you can leave that value out; “Required” means you must provide it. Native HTML attributes also work where the component uses a native element.
| Name | Type or signature | Default | What it does |
|---|---|---|---|
itemsprop | readonly DropdownMenuItem[] | undefined | Not set | Data items displayed by this component. |
labelprop | string | undefined | Not set | Visible or accessible name for this item. |
openmodel | boolean | undefined | Not set | Current open state. Use v-model:open to keep it in sync with your page. |
defaultOpenprop | boolean | undefined | Not set | Starting open state when the parent does not control open. |
disabledprop | boolean | undefined | Not set | Prevent interaction and show the disabled state. |
widthprop | number | undefined | 224 | Choose the width of this content. |
gapprop | number | undefined | 12 | Space in pixels between the trigger and floating content. |
alignprop | "start" | "end" | "center" | undefined | "start" | Choose how content aligns within its container. |
sideprop | "top" | "bottom" | undefined | "bottom" | Choose the side on which this content appears. |
dirprop | "ltr" | "rtl" | undefined | Not set | Set the text direction used for keyboard and layout behavior. |
selectevent | [item: DropdownMenuAction] | — | Emitted when the user selects an item. |
update:openevent | [value: boolean | undefined] | — | Requests a new open value from the parent. |
openChangeevent | [open: boolean] | — | Emitted after this value or state changes. |
triggerslot | { props: OverlayTriggerProps; open: boolean; } | Optional | Content for the trigger area of DropdownMenu. |
defaultslot | {} | Optional | Content shown inside DropdownMenu. |
itemslot | { item: DropdownMenuDataItem; } | Optional | Content for the item area of DropdownMenu. |
openexposed | (fromLast?: boolean) => void | — | Open this component from application code. |
closeexposed | (restoreFocus?: boolean) => void | — | Close this component from application code. |
| Name | Type or signature | Default | What it does |
|---|---|---|---|
idprop | string | Required | Give the control an ID so a label or description can refer to it. |
labelprop | string | Required | Visible or accessible name for this item. |
checkedmodel | boolean | undefined | false | Current checked state of this choice. |
disabledprop | boolean | undefined | Not set | Prevent interaction and show the disabled state. |
destructiveprop | boolean | undefined | Not set | Show that an action has a potentially destructive result. |
shortcutprop | string | undefined | Not set | Keyboard shortcut displayed beside this action. |
selectevent | [action: DropdownMenuAction] | — | Emitted when the user selects an item. |
update:checkedevent | [value: boolean] | — | Requests a new checked value from the parent. |
checkedChangeevent | [checked: boolean] | — | Emitted after this value or state changes. |
defaultslot | (() => unknown) | undefined | Optional | Content shown inside DropdownMenuCheckboxItem. |
prefixslot | (() => unknown) | undefined | Optional | Content shown before the main label or value. |
suffixslot | (() => unknown) | undefined | Optional | Content shown after the main label or value. |
| Name | Type or signature | Default | What it does |
|---|---|---|---|
arrowprop | boolean | undefined | true | Controls the arrow behavior of DropdownMenuContent. |
defaultslot | {} | Optional | Content shown inside DropdownMenuContent. |
| Name | Type or signature | Default | What it does |
|---|---|---|---|
labelprop | string | undefined | Not set | Visible or accessible name for this item. |
defaultslot | {} | Optional | Content shown inside DropdownMenuGroup. |
| Name | Type or signature | Default | What it does |
|---|---|---|---|
itemprop | DropdownMenuAction | undefined | Not set | Controls the item behavior of DropdownMenuItem. |
idprop | string | undefined | Not set | Give the control an ID so a label or description can refer to it. |
labelprop | string | undefined | Not set | Visible or accessible name for this item. |
disabledprop | boolean | undefined | Not set | Prevent interaction and show the disabled state. |
destructiveprop | boolean | undefined | Not set | Show that an action has a potentially destructive result. |
shortcutprop | string | undefined | Not set | Keyboard shortcut displayed beside this action. |
selectevent | [action: DropdownMenuAction] | — | Emitted when the user selects an item. |
defaultslot | (() => unknown) | undefined | Optional | Content shown inside DropdownMenuItem. |
prefixslot | (() => unknown) | undefined | Optional | Content shown before the main label or value. |
suffixslot | (() => unknown) | undefined | Optional | Content shown after the main label or value. |
| Name | Type or signature | Default | What it does |
|---|---|---|---|
defaultslot | {} | Optional | Content shown inside DropdownMenuLabel. |
| Name | Type or signature | Default | What it does |
|---|---|---|---|
modelValuemodel | string | undefined | Not set | Current value. Use v-model to keep it in sync with your page. |
defaultValueprop | string | undefined | Not set | Starting value when the parent does not control the value. |
update:modelValueevent | [value: string | undefined] | — | Requests a new model value from the parent. |
valueChangeevent | [value: string] | — | Emitted after this value or state changes. |
defaultslot | {} | Optional | Content shown inside DropdownMenuRadioGroup. |
| Name | Type or signature | Default | What it does |
|---|---|---|---|
idprop | string | Required | Give the control an ID so a label or description can refer to it. |
valueprop | string | Required | Value represented by this control or option. |
labelprop | string | Required | Visible or accessible name for this item. |
disabledprop | boolean | undefined | Not set | Prevent interaction and show the disabled state. |
shortcutprop | string | undefined | Not set | Keyboard shortcut displayed beside this action. |
selectevent | [action: DropdownMenuAction] | — | Emitted when the user selects an item. |
defaultslot | (() => unknown) | undefined | Optional | Content shown inside DropdownMenuRadioItem. |
prefixslot | (() => unknown) | undefined | Optional | Content shown before the main label or value. |
suffixslot | (() => unknown) | undefined | Optional | Content shown after the main label or value. |
| Name | Type or signature | Default | What it does |
|---|
| Name | Type or signature | Default | What it does |
|---|---|---|---|
openmodel | boolean | undefined | Not set | Current open state. Use v-model:open to keep it in sync with your page. |
defaultOpenprop | boolean | undefined | Not set | Starting open state when the parent does not control open. |
disabledprop | boolean | undefined | Not set | Prevent interaction and show the disabled state. |
update:openevent | [value: boolean | undefined] | — | Requests a new open value from the parent. |
openChangeevent | [open: boolean] | — | Emitted after this value or state changes. |
defaultslot | {} | Optional | Content shown inside DropdownMenuSub. |
| Name | Type or signature | Default | What it does |
|---|---|---|---|
defaultslot | {} | Optional | Content shown inside DropdownMenuSubContent. |
| Name | Type or signature | Default | What it does |
|---|---|---|---|
defaultslot | () => unknown | Required | Content shown inside DropdownMenuSubTrigger. |
prefixslot | (() => unknown) | undefined | Optional | Content shown before the main label or value. |
suffixslot | (() => unknown) | undefined | Optional | Content shown after the main label or value. |
| Name | Type or signature | Default | What it does |
|---|---|---|---|
asChildprop | boolean | undefined | Not set | Use one child element as the control instead of adding another wrapper. |
defaultslot | {} | Optional | Content shown inside DropdownMenuTrigger. |
// packages/frameworks/vue/components/dropdown-menu/types.ts
// ------- TYPES -------
export interface DropdownMenuAction {
id: string
label: string
disabled?: boolean
destructive?: boolean
shortcut?: string
kind?: 'item' | 'checkbox' | 'radio'
checked?: boolean
value?: string
}
export type DropdownMenuDataItem = Omit<DropdownMenuAction, 'kind' | 'checked' | 'value'> & {
kind?: 'item'
}
export type DropdownMenuItem = DropdownMenuDataItem | { id: string; kind: 'separator' }
export interface DropdownMenuProps {
items?: readonly DropdownMenuItem[]
label?: string
open?: boolean
defaultOpen?: boolean
disabled?: boolean
width?: number
gap?: number
align?: 'start' | 'center' | 'end'
side?: 'top' | 'bottom'
dir?: 'ltr' | 'rtl'
}
export interface DropdownMenuTriggerProps {
asChild?: boolean
}
export interface DropdownMenuContentProps {
arrow?: boolean
}
export interface DropdownMenuCheckboxItemProps {
id: string
label: string
checked?: boolean
disabled?: boolean
destructive?: boolean
shortcut?: string
}
export interface DropdownMenuRadioGroupProps {
modelValue?: string
defaultValue?: string
}
export interface DropdownMenuRadioItemProps {
id: string
value: string
label: string
disabled?: boolean
shortcut?: string
}
export interface DropdownMenuSubProps {
open?: boolean
defaultOpen?: boolean
disabled?: boolean
}