Dropdown menu

A list of actions on one thing. Nothing is selected afterwards, which is what separates it from a Select: a menu fires, a select holds a value.

Reach for it

A list of actions fired from one control.

Not for

Choosing a value. A menu is not a form control.

Groups, separators and intents

Items are menu items rather than options, so a screen reader announces them as actions. Name the trigger: an icon with no accessible name is announced as button and nothing else. A destructive item takes the danger intent rather than a colour.

Last action: none

Shortcuts

An item names its key with shortcut. The key sits at the right edge of the row, and the item announces it through aria-keyshortcuts, so a screen reader hears the action and its key apart. The menu only shows the key: the screen listens for it while the menu is open.

API reference

DropdownMenu

Also takes the props of Base UI Menu Root.

DropdownMenuTrigger

Also takes the props of Base UI Menu Trigger.

DropdownMenuContent

PropTypeDefaultDescription
children*ReactNode-
align'start' | 'center' | 'end'-
containerHTMLElement | null-Where the menu mounts. Defaults to the document body. A menu opened inside a drawer or a dialog has to mount inside that overlay's own container, or it lands under it and the items cannot be reached. An app that stacks overlays passes its portal container here rather than reaching for a z-index.

DropdownMenuItem

PropTypeDefaultDescription
children*ReactNode-
data-testidstring-Names the element for a test. Never rendered, never announced.
onClick() => void-
isDisabledboolean-
intent'neutral' | 'danger'-`danger` marks a destructive action. An intent, never a colour.
shortcutstring-The key that fires the item, as the user sees it: `G`, `Shift+D`. The menu only shows it. The caller listens for the key. A prop rather than shadcn's `DropdownMenuShortcut` child, because the item must know the key to announce it with `aria-keyshortcuts`. A child would read the key into the item's name instead: "Get the code G".

DropdownMenuSeparator

DropdownMenuGroup

PropTypeDefaultDescription
label*string-
children*ReactNode-