Skip to contentKino
Skip to Content

Dropdown menu

A menu that grows out from under its button, with one highlight that glides from item to item.

npx shadcn add https://kinoui.com/r/dropdown-menu.json
Share on

Examples

Default

It grows out from under its button, and one highlight glides from item to item.

Checkboxes and radios

They keep the menu open, and the other items line up with their text.

Installation

npx shadcn@latest add https://kinoui.com/r/dropdown-menu.json
Files
lib/reduce-motion.tslib/scroll.tscomponents/kino/separator.tsxlib/popup.tslib/resize.tslib/run-progress.tslib/highlight.tslib/menu.tsxcomponents/kino/dropdown-menu.tsx
Packages
@base-ui/reactclass-variance-authority

New to Kino? Installation covers what your project needs first and the @kino namespace.

API reference

PropTypeDefaultDescription
defaultOpenbooleanfalseWhether it is open at first, when you leave the state to the menu.
openbooleanNoneWhether it is open, when you hold the state.
onOpenChange(open, details) => voidNoneCalled when it opens or closes.
PropTypeDefaultDescription
side'left''top''bottom''right''inline-start''inline-end''bottom'The side of the trigger it opens on. It moves to another side when there is no room.
align'start''center''end''start'How it lines up with the trigger along that side.
sideOffsetnumberfunction6The gap between it and the trigger, in pixels.
alignOffsetnumberfunction0How far it shifts along the side, in pixels.
classNamestringNoneGoes to the list of items inside the box, 12rem to 20rem wide, unless you set a width.
PropTypeDefaultDescription
variant'default''destructive''default'Destructive is for an action that deletes or can’t be undone.
closeOnClickbooleantrueWhether picking it closes the menu.
PropTypeDefaultDescription
checkedbooleanNoneWhether it is on, when you hold the state.
defaultCheckedbooleanfalseWhether it is on at first, when you leave the state to the item.
onCheckedChange(checked, details) => voidNoneCalled when it turns on or off.

Data attributes

AttributeOnDescription
data-highlightedDropdownMenuItem and the other itemsPresent on the item the highlight is on.
data-checkedDropdownMenuCheckboxItem, DropdownMenuRadioItemPresent while it is on or picked.
data-disabledevery itemPresent while it is disabled.
data-popup-openDropdownMenuSubTrigger and the triggerPresent while its menu is open.

Accessibility

  • Enter, Space or the down arrow on the trigger opens the menu on its first item; the up arrow opens it on its last.
  • Arrow keys move between items, Home and End go to the first and the last, and typing a letter goes to the next item that starts with it.
  • Enter or Space picks an item. The arrow that points into a submenu opens it, and the other arrow or Escape closes it.
  • Focus goes back to the trigger when the menu closes.
  • A checkbox item is announced as checked or not, and a radio item as picked or not. On screen a checked item shows its tick, and a picked radio item its tint and medium label, so neither relies on colour alone.
  • When the system asks for less motion, menus only fade and the highlight moves at once.