Dropdown Menu
A menu of actions opened from a trigger. Compose DropdownMenuTrigger +
DropdownMenuContent with DropdownMenuItem, DropdownMenuLabel,
DropdownMenuSeparator, radio items (DropdownMenuRadioGroup /
DropdownMenuRadioItem), and nested submenus (DropdownMenuSub /
DropdownMenuSubTrigger / DropdownMenuSubContent). The menu anchors to its
trigger and flips or shifts to stay within the viewport, supports keyboard list
navigation, and dismisses on outside-click or Esc; submenus open on hover.
Trigger wedge
The menu shows a wedge by default, connecting it visually to its trigger, as
Menu, Select, Popover and Tooltip do; pass arrow={false} for a bare
panel. The wedge uses
Select's seven-pixel shape, inherits the panel surface, and follows the actual
placement when the menu flips or shifts near a viewport edge. It works on all
four sides and adds four pixels to the configured sideOffset for clearance.
Keyboard navigation and focus return are unchanged.
The menu unfolds from the trigger's corner when it opens and folds back into
it when it closes — on Escape, an outside click or a picked item — the unfold
played backwards in 220ms. Focus returns to the trigger as the fold starts, and
the folding menu is inert, aria-hidden and never takes the pointer.
Reopening mid-fold animates the same menu back open; reduced motion makes the
fold a 100ms fade. Submenus fold the same way.
Props
DropdownMenu
| Prop | Type | Default | Description |
|---|---|---|---|
side | 'top' | 'right' | 'bottom' | 'left' | 'bottom' | Preferred side. |
arrow | boolean | true | Show a wedge facing the trigger after placement flips. |
sideOffset | number | 4 | Panel gap; arrow adds four pixels of clearance. |
align | 'start' | 'center' | 'end' | 'start' | Alignment along the side. |
open / defaultOpen / onOpenChange | — | — | Controlled / uncontrolled open state. |
Items
DropdownMenuItem takes onSelect (fired on activation; the menu then closes),
disabled, and asChild (render through to a single child element instead of a
<div>). DropdownMenuRadioGroup takes value + onValueChange;
DropdownMenuRadioItem takes value. DropdownMenuTrigger accepts asChild.
DropdownMenuShortcut renders a right-aligned keyboard hint (e.g. ⌘C) inside an
item.