Skip to content

Dropdown menu

A menu on Base UI Menu with checkbox, radio and sub-menu rows.

Default

Checkbox items

Radio items

With a submenu

Installation

npx shadcn@latest add @khaeli/dropdown-menu

Install @khaeli/foundation first: this item's styling lives in its tokens and [data-slot] rules.

Installs with

Registry items
npm packages
  • @base-ui/react ^1.7.0
  • @keyline-icons/react ^2.2.0

Keyboard

EnterSpaceArrow Down
On the trigger, open the menu and focus its first row.
Arrow DownArrow Up
Move between rows and wrap at either end. A disabled row is still reached and is announced as disabled; Enter does nothing on it.
HomeEnd
Go to the first and the last row.
A letter
Moves to the next row that starts with it.
EnterSpace
Run the row and close the menu. On a checkbox or radio row they change the value and the menu stays open.
Arrow RightArrow Left
On a sub-menu row, Arrow Right (or Enter) opens the sub-menu and focuses its first row. Arrow Left closes it and returns to its row.
Escape
Closes the menu and returns focus to the trigger. In a sub-menu it closes the sub-menu only.
Tab
Closes the menu and moves focus to the control after the trigger.

Accessible name

  • The menu is named by its trigger. An icon-only trigger needs an aria-label, which then names the menu too.
  • DropdownMenuLabel names the DropdownMenuGroup it sits in, so keep it inside one.
  • Checkbox and radio rows are announced with their state (menuitemcheckbox, menuitemradio, aria-checked).
  • DropdownMenuShortcut is read as part of the row's name. It shows the keys and binds nothing.
  • variant="destructive" does not colour the row: its text matches the other rows and only its icon is drawn stronger. Say what the row does in its label.

Registry JSON

The item as the shadcn CLI reads it, with every file it ships: https://ui.khaeli.com/r/dropdown-menu.json