Dropdown
Button that opens a menu of actions with icons, shortcuts and separators. The size prop (xs, sm, md, lg, xl) sets the button and menu item density.
Import
Vue
import { UiDropdown } from '@ziyarago/ui/vue'Actions
Vue
<UiDropdown
label="Actions"
:items="[{ label: 'Edit', value: 'edit', icon: 'pencil', shortcut: 'E' }, { label: 'Duplicate', value: 'dup', icon: 'copy' }, { separator: true }, { label: 'Delete', value: 'del', icon: 'trash', tone: 'danger' }]"
/>Small with icon
Vue
<UiDropdown
label="Sort"
size="sm"
icon="arrow-up-down"
:items="[{ label: 'Price', value: 'price' }, { label: 'Rating', value: 'rating' }, { label: 'Distance', value: 'dist' }]"
/>Icon only
Vue
<UiDropdown
icon-only
ghost
label="Row actions"
:items="[{ label: 'Edit', value: 'edit', icon: 'pencil' }, { label: 'Duplicate', value: 'dup', icon: 'copy' }, { separator: true }, { label: 'Delete', value: 'del', icon: 'trash-2', tone: 'danger' }]"
/>Custom trigger
AY
Vue
<UiDropdown
:items="[{ label: 'Profile', value: 'profile', icon: 'user' }, { label: 'Settings', value: 'settings', icon: 'settings' }, { separator: true }, { label: 'Sign out', value: 'out', icon: 'log-out' }]"
>
<template #trigger>
<UiAvatar name="Amina Yusuf" :size="36" />
</template>
</UiDropdown>In a table row
Vue
<div
:style="{ overflow: 'hidden', border: '1px solid var(--zg-stroke)', borderRadius: '16px' }"
>
<table class="zg-table">
<tbody>
<tr>
<td>
Umrah Economy, 10 nights
</td>
<td :style="{ width: '56px', textAlign: 'end' }">
<UiDropdown
icon-only
ghost
icon="ellipsis"
label="Row actions"
:items="[{ label: 'View booking', value: 'view', icon: 'eye' }, { label: 'Edit', value: 'edit', icon: 'pencil' }, { separator: true }, { label: 'Cancel', value: 'cancel', icon: 'trash-2', tone: 'danger' }]"
/>
</td>
</tr>
</tbody>
</table>
</div>Sizes
Vue
<UiDropdown
size="xs"
label="Actions"
:items="[{ label: 'Edit', value: 'edit', icon: 'pencil', shortcut: 'E' }, { label: 'Duplicate', value: 'dup', icon: 'copy' }, { separator: true }, { label: 'Delete', value: 'del', icon: 'trash', tone: 'danger' }]"
/>
<UiDropdown
size="sm"
label="Actions"
:items="[{ label: 'Edit', value: 'edit', icon: 'pencil', shortcut: 'E' }, { label: 'Duplicate', value: 'dup', icon: 'copy' }, { separator: true }, { label: 'Delete', value: 'del', icon: 'trash', tone: 'danger' }]"
/>
<UiDropdown
size="md"
label="Actions"
:items="[{ label: 'Edit', value: 'edit', icon: 'pencil', shortcut: 'E' }, { label: 'Duplicate', value: 'dup', icon: 'copy' }, { separator: true }, { label: 'Delete', value: 'del', icon: 'trash', tone: 'danger' }]"
/>
<UiDropdown
size="lg"
label="Actions"
:items="[{ label: 'Edit', value: 'edit', icon: 'pencil', shortcut: 'E' }, { label: 'Duplicate', value: 'dup', icon: 'copy' }, { separator: true }, { label: 'Delete', value: 'del', icon: 'trash', tone: 'danger' }]"
/>
<UiDropdown
size="xl"
label="Actions"
:items="[{ label: 'Edit', value: 'edit', icon: 'pencil', shortcut: 'E' }, { label: 'Duplicate', value: 'dup', icon: 'copy' }, { separator: true }, { label: 'Delete', value: 'del', icon: 'trash', tone: 'danger' }]"
/>API reference
Button that opens a menu of actions; use for "more" menus and action lists.
Props
PropType and valuesDefaultDescription
labelstring—Text of the trigger button. With iconOnly it becomes the aria-label (and tooltip) of the square button.iconstring—Icon name before the label; the only content of the button with iconOnly (default "ellipsis").iconOnlybooleanfalseRenders the trigger like IconButton: a square icon button without label and chevron. Use label for the accessible name.ghostbooleanfalseWith iconOnly: a transparent button without background, for table rows and toolbars.alignstartend'start'Which edge of the trigger the menu lines up with (mirrored in RTL). iconOnly defaults to end.items{ label: string; value?: string; icon?: string; shortcut?: string; tone?: 'danger'; disabled?: boolean; onClick?: (item) => void; separator?: boolean }[]'[]'Menu entries. Item fields: label, value (passed to select), icon (icon name), shortcut (kbd hint on the right), tone "danger" (red), disabled true (dimmed, not clickable), onClick (called with the item when clicked, before the select event), separator true (renders a divider; other fields ignored).disabledbooleanfalseDisables the trigger button so the menu cannot open.sizexssmmdlgxl'md'Scale of trigger button and menu.Slots
Vue: named slots. React: a prop with the same name; default is children.
triggerCustom trigger element (Vue #trigger / React trigger prop) instead of the built-in button. The kit adds aria-haspopup, aria-expanded and aria-controls to its first focusable element, toggles on click and opens on ArrowDown / ArrowUp; a non-interactive element becomes role="button" with tabindex 0.Events
Vue: @name. React: onName.
selectCalled with the item value when an entry is clicked. The menu closes first.Notes
- Each item may also have its own onClick and disabled. Open state is internal; the menu closes on outside click and on Escape.
- The menu is rendered in document.body with position: fixed, so overflow, transform or a scrolling modal body never clip it. It flips above the trigger when there is no room below, stays inside the viewport and follows the trigger on scroll and resize.