Skip to content

DropdownMenu

A contextual menu that reveals a list of actions or options when its trigger is activated.

  • stable
  • since v0.1.0
  • 4.2 kB
  • overlay
  • menu
  • accessible

Uses role="menu" / role="menuitem"; keyboard navigable with arrow keys; Esc closes; focus returns to trigger.

Preview
Open
tsx

Add a leading icon to any DropdownMenuItem via the icon prop.

Preview
Open
tsx

Render keyboard shortcut hints using DropdownMenuShortcut. Each character is wrapped in a Kbd keycap automatically.

Preview
Open
tsx

Use DropdownMenuCheckboxItem for toggleable items and DropdownMenuRadioItem inside a DropdownMenuRadioGroup for mutually exclusive selections.

Preview
Open
tsx
PropTypeDefaultDescription
container
HTMLElement|(() => HTMLElement)
className
string
  • The menu follows the ARIA Menu Button pattern: role="menu" on the content, role="menuitem" on each item.
  • Arrow keys navigate between items; Home / End jump to first / last item.
  • Pressing Esc closes the menu and returns focus to the trigger.
  • DropdownMenuCheckboxItem carries role="menuitemcheckbox"; DropdownMenuRadioItem carries role="menuitemradio".
  • DropdownMenuShortcut is aria-hidden="true" — decorative only, not announced.
  • Use DropdownMenuSub + DropdownMenuSubTrigger + DropdownMenuSubContent for nested sub-menus.
  • Use DropdownMenuTrigger asChild instead of DropdownMenuTriggerButton to compose with any custom trigger element.
  • Add description to any item for a muted second line of context below the label.
  • Use variant="danger" on destructive items for red highlight styling.