Dropdown
A menu of actions or options, triggered by a button
pnpm add @wandercom/design-system-web
Built on the Base UI Menu primitive, the dropdown supports icons, keyboard shortcuts, separators, checkboxes, radio groups, and nested submenus.
import {
Dropdown,
DropdownTrigger,
DropdownContent,
DropdownItem,
} from '@wandercom/design-system-web/ui/dropdown';
export function Example() {
return (
<Dropdown>
<DropdownTrigger asChild>
<button>Open menu</button>
</DropdownTrigger>
<DropdownContent>
<DropdownItem>Profile</DropdownItem>
<DropdownItem>Settings</DropdownItem>
<DropdownItem>Logout</DropdownItem>
</DropdownContent>
</Dropdown>
);
}The dropdown trigger supports a styled default variant matching SelectTrigger, a sm size, and an unstyled variant for custom trigger elements via asChild.
A simple dropdown menu with basic items.
Add icons to menu items for visual clarity.
Group related items with separators and labels.
Display keyboard shortcuts alongside menu items.
Use checkboxes for togglable options.
Use radio groups for mutually exclusive options.
Create nested menus for hierarchical options.
Use the destructive variant to indicate dangerous actions.
Use the inset prop to align items with labels or icons.
By default an item grows and wraps its label across multiple lines. Pass truncate to pin the row to a single line and ellipsize overflowing text — the full label stays available to screen readers. Truncation is intended for plain text labels; items with icons or shortcuts should use the default growing layout.
Long menus are capped at 500px by default and scroll, with chevron indicators showing when more items are available in either direction. Set scrollable={false} on DropdownContent to let the menu grow to the full available height instead.
open?:
defaultOpen?:
onOpenChange?:
modal?:
variant?:
size?:
asChild?:
nativeButton?:
className?:
className?:
sideOffset?:
side?:
align?:
alignOffset?:
scrollable?:
container?:
className?:
variant?:
inset?:
truncate?:
disabled?:
onSelect?:
closeOnClick?:
asChild?:
className?:
checked?:
onCheckedChange?:
disabled?:
onSelect?:
closeOnClick?:
className?:
value?:
onValueChange?:
value:
disabled?:
onSelect?:
closeOnClick?:
className?:
inset?:
className?:
className?:
className?:
open?:
defaultOpen?:
onOpenChange?:
inset?:
disabled?:
className?:
sideOffset?:
side?:
align?:
alignOffset?:
className?:
The dropdown is built on the Base UI Menu primitive with full accessibility support:
- Uses semantic
menurole and appropriate ARIA attributes - Supports keyboard navigation with arrow keys
- Opens and closes with Enter or Space
- Closes on Escape key press
- Supports typeahead to jump to matching items
- Manages focus automatically when opened and closed
- Honors disabled state on individual items
- Checkbox and radio items include proper ARIA state attributes