Skip to the content

Dropdown

Dropdown opens a floating panel below a trigger element. Pass options for an action menu built from a List, or content for any other panel. It requires one of the two.
Actions

When to use

Use when
  • A button opens a menu of actions — edit, duplicate, delete.
  • A compact filter or picker needs more than a native select.
Avoid when
  • The text is a short hint — use Tooltip.
  • The panel is a title plus description — use Popover.
  • The flow must block the page — use Modal.

Usage

options renders an exclusive List: one item stays selected, and clicking it again keeps it. When both options and content are set, options wins.

<Dropdown options={[{ title: 'Item 1', icon: <Icon icon={clock} /> }, { title: 'Item 2' }]}>
  <Button text="Actions" />
</Dropdown>

Custom content

content takes any node, or a function that receives { close } — for example to close the panel after a form inside it submits. Build the List yourself here when you need toggle or multiple selection.

<Dropdown full content={<List multiple content={items} />}>
  <Button text="Multiple selection" />
</Dropdown>

full matches the panel to the trigger's width; width sets a fixed width and wins over full. position aligns the panel to the trigger's left (default), center or right edge.

Trigger

An element trigger gets an automatic click toggle. With hoverable, a mouse hover also opens it; touch still opens on tap. For full control, pass a function as children: it receives { isOpen, open, toggle } and must wire the toggle itself. distance sets the trigger–menu gap in px (default 4); hideArrow is deprecated and has no effect.

<Dropdown options={items}>
  {({ isOpen, toggle }) => (
    <Button
      onClick={toggle}
      text="Menu"
      iconPosition="right"
      icon={<Icon icon={isOpen ? chevronDown : chevronRight} />}
    />
  )}
</Dropdown>

The panel scales in from the trigger and fades out on close (motion="scale"). Pass another motion preset, or motion="none" for an instant open and close. Reduced-motion settings disable the animation.

Accessibility

  • The trigger gets aria-haspopup and aria-expanded. The panel is role="menu" with options, role="dialog" with content.
  • Escape and a click outside close the panel.
  • The trigger must be focusable — use a Button, not a plain div.

Properties

See also