[ Overlays ]

Dropdown

A menu of actions that opens from a trigger button. Supports icons, dividers, disabled and danger items, full keyboard navigation and closing on outside click.

2 examplesDark modeAccessible

Import#

import { Dropdown } from 'reusify-ui';

When to use#

  • Grouping secondary actions behind one button: row actions ("⋯"), account menus.
  • For choosing a value in a form, use Select instead.

Examples#

Account menu#

trigger is any element (usually a Button). Each item can have an icon, be disabled, or be marked as danger.

<Dropdown
  trigger={<Button variant="secondary" leftIcon={<FiUser />}>Account</Button>}
  items={[
    { label: 'Profile', icon: <FiUser />, onClick: openProfile },
    { label: 'Settings', icon: <FiSettings />, onClick: openSettings },
    { divider: true },
    { label: 'Billing', disabled: true },
    { label: 'Sign out', icon: <FiLogOut />, danger: true, onClick: signOut },
  ]}
/>

Align to the end#

Use align="end" for triggers near the right edge, like a "⋯" button at the end of a table row.

invoice-2026-11.pdf
<Dropdown
  align="end"
  trigger={<Button variant="ghost" aria-label="Row actions"><FiMoreVertical /></Button>}
  items={[
    { label: 'Edit', icon: <FiEdit2 /> },
    { label: 'Duplicate', icon: <FiCopy /> },
    { divider: true },
    { label: 'Delete', icon: <FiTrash2 />, danger: true },
  ]}
/>

Used in designs#

Dropdown in real layouts: these 3 designs use it. Open one to try it and copy the code.

API reference#

<Dropdown />

trigger*-
ReactElement

Element that toggles the menu. Its own onClick still runs.

items*-
DropdownItem[]

Menu entries (see below).

align'start'
'start' | 'end'

Align the menu to the left or right edge of the trigger.

closeOnSelecttrue
boolean

Close after an item is chosen.

className-
string

Class for the wrapper.

<DropdownItem />

label-
ReactNode

Item text.

onClick-
() => void

Called when the item is chosen.

icon-
ReactNode

Icon before the label.

disabled-
boolean

Item cannot be chosen.

danger-
boolean

Shows the item in the danger color.

divider-
boolean

Renders a separator line instead of an item.

key-
string

Optional stable React key.

Accessibility#

  • The trigger gets aria-haspopup="menu", aria-expanded and aria-controls.
  • Arrow Down on the trigger opens the menu; Arrow Up/Down, Home and End move between items; Escape closes and returns focus to the trigger.
  • Items use role="menuitem"; dividers use role="separator".