Dropdown menu

A list of actions behind a button, with groups and keyboard shortcuts.

Choose an action to see its feedback.
Fig. 1 Open the menu. Arrow keys move, Enter runs an action, and shortcuts are shown beside it.

When to use it

Use Dropdown Menu for actions that don’t deserve their own button: row actions, overflow menus, and account menus.

It runs actions. To choose a value that stays selected, use Select.

Dropdown menuThis page

Actions from a button.

Choose an action to see its feedback.

Row actions and overflow menus.

Command

Search and run.

New document⌘N
Search files
Open recent
Notifications
Appearance
Toggle dark mode
Preferences⌘,
⌘J

Many actions people know by name.

Fig. 2 Two lists of actions. One opens from a button; the other is searched by name.

How it behaves

Use for actions; use Select for choosing a form value. Base UI handles arrow navigation, typeahead, focus, and Escape.

Use render={<Button />} to compose the trigger. Every icon-only trigger needs a label.

Use onClick for actions. Items can be disabled; keyboard highlighting is visible.

The full installed API includes DropdownMenuGroup/Label, CheckboxItem, RadioGroup/RadioItem, Sub/SubTrigger/SubContent, and Shortcut. DropdownMenuShortcut renders a plain Kbd at the end of the item, matching Command.

Build it

Add it with the shadcn CLI:

Terminal

A complete example. Change the values to fit your product:

dropdown-menu-example.tsx

The full source is yours to edit once installed:

dropdown-menu.tsx