Ethereal Garden

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

Basic

A basic Dropdown Menu with simple items.

Checkboxes

A Dropdown Menu with checkbox items for multiple selection.

Radio Group

A Dropdown Menu with radio items for single selection.

A Dropdown Menu with nested submenus.

Props

PropTypeDefault
modal?
boolean
-
onOpenChange?
((open: boolean) => void)
-
defaultOpen?
boolean
-
open?
boolean
-
PropTypeDefault
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
-
PropTypeDefault
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>
-
PropTypeDefault
textValue?
string
-
disabled?
boolean
-
asChild?
boolean
-
key?
Key | null
-
ref?
Ref<HTMLDivElement>
-
PropTypeDefault
onCheckedChange?
((checked: boolean) => void)
-
checked?
CheckedState
-
textValue?
string
-
disabled?
boolean
-
asChild?
boolean
-
key?
Key | null
-
ref?
Ref<HTMLDivElement>
-
PropTypeDefault
value
string
-
textValue?
string
-
disabled?
boolean
-
asChild?
boolean
-
key?
Key | null
-
ref?
Ref<HTMLDivElement>
-
PropTypeDefault
asChild?
boolean
-
key?
Key | null
-
ref?
Ref<HTMLDivElement>
-
PropTypeDefault
asChild?
boolean
-
key?
Key | null
-
ref?
Ref<HTMLDivElement>
-
PropTypeDefault
asChild?
boolean
-
key?
Key | null
-
ref?
Ref<HTMLDivElement>
-
PropTypeDefault
onOpenChange?
((open: boolean) => void)
-
defaultOpen?
boolean
-
open?
boolean
-
PropTypeDefault
textValue?
string
-
disabled?
boolean
-
asChild?
boolean
-
key?
Key | null
-
ref?
Ref<HTMLDivElement>
-
PropTypeDefault
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>
-
PropTypeDefault
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 Escape key closes the dropdown
  • Supports proper ARIA attributes for describing relationships between elements