Skip to content

Dropdown

Dropdown shows a menu of actions from its trigger, with submenus, groups and dividers. Choosing an item calls onSelect and closes the whole menu. The menu follows Floating UI’s nested menu pattern and uses the Popover surface.

Demos

Basic

By default it opens on hover below the trigger (on touch screens, on tap). trigger="click" opens it on click or Enter / ↓ and moves focus into the menu. Disabled items are skipped. showArrow adds an arrow pointing at the trigger (off by default; submenus never have one).

An option with children opens a submenu to the right: on hover (the pointer can move diagonally into it without closing it), or with →; ← goes back. icon adds an icon, { type: "divider" } a line and { type: "group", label, children } a labelled group.

Context menu

With x / y and no trigger the menu opens at a point: a context menu. Drive it with show and trigger="manual".

Keyboard

↑ / ↓ move between items (skipping disabled ones, wrapping), Home / End jump to the ends, typing jumps to the next item starting with that letter, → opens a submenu and ← closes it, Enter or Space chooses, Escape closes the menu and returns focus to the trigger.

Props

NameTypeDefaultDescriptionVersion
optionsDropdownMixedOption[]requiredItems { key, label, icon?, disabled?, children? }, dividers and groups.Unreleased
onSelect(key, option) => voidundefinedCalled when an item without a submenu is chosen.Unreleased
triggerhover | click | manualhoverWhat opens it.Unreleased
show / defaultShowbooleanundefined / falseControlled / initial visibility.Unreleased
onUpdateShow(show: boolean) => voidundefinedCalled when the menu wants to open or close.Unreleased
placementPopoverPlacementbottomWhere the menu opens; submenus open right-start.Unreleased
showArrowbooleanfalseShow an arrow pointing at the trigger; root menu only.Unreleased
sizesmall | medium | largemediumRow height and text size.Unreleased
x / ynumberundefinedOpen at a viewport point instead of next to the trigger.Unreleased
disabledbooleanfalseNever open.Unreleased
to / zIndexAs on Popover.Unreleased
onClickoutside(event: Event) => voidundefinedCalled on a press outside the trigger and the menus.Unreleased

Any other prop, and ref, goes to the trigger element.