Dropdown Menu
stableDisplays a menu to the user — such as a set of actions or functions — triggered by a button.
Basic usage
Examples
With checkboxes and radio items
Toggle options and select an exclusive value inside a dropdown.
Rich action menu
Use labels, separators, checkbox items, radio items and shortcuts in one menu.
Features
- Can be controlled or uncontrolled.
- Supports submenus with configurable reading direction.
- Supports items, labels, groups of items.
- Supports checkable items (single or multiple).
- Customize side, alignment, offsets, collision handling.
- Focus is fully managed; full keyboard navigation; typeahead support.
Installation
pnpm dlx structyl add dropdown-menuAPI Reference
DropdownMenu.Root
Contains all dropdown-menu parts.
| Prop | Type | Default |
|---|---|---|
| open | booleanControlled open state. | — |
| defaultOpen | booleanInitial open state. | — |
| onOpenChange | (open: boolean) => voidCalled when open state changes. | — |
| dir | 'ltr' | 'rtl'Reading direction. | — |
| modal | booleanWhether outside interaction is disabled. | true |
DropdownMenu.Trigger
The button that opens the menu.
| Prop | Type | Default |
|---|---|---|
| asChild | booleanMerge props onto the immediate child instead of rendering a default element. | false |
DropdownMenu.Content
The menu surface.
| Prop | Type | Default |
|---|---|---|
| side | 'top' | 'right' | 'bottom' | 'left'Preferred side. | — |
| sideOffset | numberDistance from the trigger. | — |
| align | 'start' | 'center' | 'end'Alignment. | — |
| loop | booleanWhether arrow navigation wraps. | false |
DropdownMenu.Item
A selectable menu item.
| Prop | Type | Default |
|---|---|---|
| onSelect | (event: Event) => voidCalled on selection. preventDefault to keep open. | — |
| disabled | booleanDisable the item. | false |
| inset | booleanIndent to align with checkable items. | — |
DropdownMenu.CheckboxItem
An item with a checkable state.
| Prop | Type | Default |
|---|---|---|
| checked | boolean | 'indeterminate'Checked state. | — |
| onCheckedChange | (checked: boolean) => voidCalled when toggled. | — |
DropdownMenu.RadioGroup
Groups radio items.
| Prop | Type | Default |
|---|---|---|
| value | stringSelected value. | — |
| onValueChange | (value: string) => voidCalled on change. | — |
DropdownMenu.RadioItem
An exclusive radio item.
| Prop | Type | Default |
|---|---|---|
| value | stringThe item value. | — |
DropdownMenu.Sub
Wraps a submenu.
| Prop | Type | Default |
|---|
DropdownMenu.SubTrigger
Opens a submenu.
| Prop | Type | Default |
|---|
DropdownMenu.SubContent
The submenu surface.
| Prop | Type | Default |
|---|
DropdownMenu.Label
A non-interactive group label.
| Prop | Type | Default |
|---|
DropdownMenu.Separator
A visual divider.
| Prop | Type | Default |
|---|
Keyboard interactions
Adheres to the WAI-ARIA design pattern .
| Key | Description |
|---|---|
| Space / Enter | Opens the menu and focuses the first item. |
| ArrowDown / ArrowUp | Moves focus between items. |
| ArrowRight / ArrowLeft | Opens / closes a submenu. |
| Esc | Closes the menu and returns focus to the trigger. |