Dropdown Menu
A vertically stacked menu that appears when triggered by a button.
A vertically stacked menu that appears when triggered by a button.
When To Use
- When you need to display a list of actions or options that would otherwise clutter the UI
- For providing contextual actions for elements on the page
- When you want to create nested hierarchical menus
- As an alternative to traditional navigation patterns in space-constrained interfaces
Examples
A basic Dropdown Menu with simple items.
A Dropdown Menu with checkbox items for multiple selection.
A Dropdown Menu with radio items for single selection.
A Dropdown Menu with nested submenus.
Props
DropdownMenu
| Prop | Type | Default |
|---|---|---|
modal? | boolean | - |
onOpenChange? | ((open: boolean) => void) | - |
defaultOpen? | boolean | - |
open? | boolean | - |
DropdownMenuTrigger
| Prop | Type | Default |
|---|---|---|
asChild? | boolean | - |
value? | string | number | readonly string[] | - |
type? | "button" | "submit" | "reset" | - |
name? | string | - |
formTarget? | string | - |
formNoValidate? | boolean | - |
formMethod? | string | - |
formEncType? | string | - |
formAction? | string | ((formData: FormData) => void | Promise<void>) | - |
disabled? | boolean | - |
key? | Key | null | - |
ref? | Ref<HTMLButtonElement> | - |
form? | string | - |
DropdownMenuContent
| Prop | Type | Default |
|---|---|---|
forceMount? | true | - |
onInteractOutside? | ((event: PointerDownOutsideEvent | FocusOutsideEvent) => void) | - |
onFocusOutside? | ((event: FocusOutsideEvent) => void) | - |
onPointerDownOutside? | ((event: PointerDownOutsideEvent) => void) | - |
onEscapeKeyDown? | ((event: KeyboardEvent) => void) | - |
loop? | boolean | false |
onCloseAutoFocus? | ((event: Event) => void) | - |
updatePositionStrategy? | "always" | "optimized" | - |
hideWhenDetached? | boolean | - |
sticky? | "partial" | "always" | - |
collisionPadding? | number | Partial<Record<"top" | "right" | "bottom" | "left", number>> | - |
collisionBoundary? | Boundary | Boundary[] | - |
avoidCollisions? | boolean | - |
arrowPadding? | number | - |
alignOffset? | number | - |
align? | "center" | "start" | "end" | - |
sideOffset? | number | - |
side? | "top" | "right" | "bottom" | "left" | - |
asChild? | boolean | - |
key? | Key | null | - |
ref? | Ref<HTMLDivElement> | - |
DropdownMenuItem
| Prop | Type | Default |
|---|---|---|
textValue? | string | - |
disabled? | boolean | - |
asChild? | boolean | - |
key? | Key | null | - |
ref? | Ref<HTMLDivElement> | - |
DropdownMenuCheckboxItem
| Prop | Type | Default |
|---|---|---|
onCheckedChange? | ((checked: boolean) => void) | - |
checked? | CheckedState | - |
textValue? | string | - |
disabled? | boolean | - |
asChild? | boolean | - |
key? | Key | null | - |
ref? | Ref<HTMLDivElement> | - |
DropdownMenuRadioItem
| Prop | Type | Default |
|---|---|---|
value | string | - |
textValue? | string | - |
disabled? | boolean | - |
asChild? | boolean | - |
key? | Key | null | - |
ref? | Ref<HTMLDivElement> | - |
DropdownMenuLabel
| Prop | Type | Default |
|---|---|---|
asChild? | boolean | - |
key? | Key | null | - |
ref? | Ref<HTMLDivElement> | - |
DropdownMenuSeparator
| Prop | Type | Default |
|---|---|---|
asChild? | boolean | - |
key? | Key | null | - |
ref? | Ref<HTMLDivElement> | - |
DropdownMenuGroup
| Prop | Type | Default |
|---|---|---|
asChild? | boolean | - |
key? | Key | null | - |
ref? | Ref<HTMLDivElement> | - |
DropdownMenuSub
| Prop | Type | Default |
|---|---|---|
onOpenChange? | ((open: boolean) => void) | - |
defaultOpen? | boolean | - |
open? | boolean | - |
DropdownMenuSubTrigger
| Prop | Type | Default |
|---|---|---|
textValue? | string | - |
disabled? | boolean | - |
asChild? | boolean | - |
key? | Key | null | - |
ref? | Ref<HTMLDivElement> | - |
DropdownMenuSubContent
| Prop | Type | Default |
|---|---|---|
forceMount? | true | - |
onInteractOutside? | ((event: PointerDownOutsideEvent | FocusOutsideEvent) => void) | - |
onFocusOutside? | ((event: FocusOutsideEvent) => void) | - |
onPointerDownOutside? | ((event: PointerDownOutsideEvent) => void) | - |
onEscapeKeyDown? | ((event: KeyboardEvent) => void) | - |
loop? | boolean | false |
updatePositionStrategy? | "always" | "optimized" | - |
hideWhenDetached? | boolean | - |
sticky? | "partial" | "always" | - |
collisionPadding? | number | Partial<Record<"top" | "right" | "bottom" | "left", number>> | - |
collisionBoundary? | Boundary | Boundary[] | - |
avoidCollisions? | boolean | - |
arrowPadding? | number | - |
alignOffset? | number | - |
sideOffset? | number | - |
asChild? | boolean | - |
key? | Key | null | - |
ref? | Ref<HTMLDivElement> | - |
DropdownMenuRadioGroup
| Prop | Type | Default |
|---|---|---|
onValueChange? | ((value: string) => void) | - |
value? | string | - |
asChild? | boolean | - |
key? | Key | null | - |
ref? | Ref<HTMLDivElement> | - |
Accessibility
The Dropdown Menu component follows WAI-ARIA guidelines for menus:
- Uses
role="menu"for the dropdown content - Uses
role="menuitem"for menu items - Uses
role="menuitemcheckbox"for checkbox items - Uses
role="menuitemradio"for radio items - Supports keyboard navigation (arrow keys, Enter, Space)
- Automatically focuses the first item when opened
- The
Escapekey closes the dropdown - Supports proper ARIA attributes for describing relationships between elements