Skip to content
Browse docs and components

Dropdown

dropdown

A menu of actions revealed from a trigger. Grouped, with labels, a destructive variant, checkbox items, and full keyboard and typeahead support from the Base UI menu primitive — Forme adds only the surface and the motion.

Responsive

Install

$npxshadcnadd@forme/dropdown

Adds the component, its registry dependencies, and the token stylesheet you import once.

Usage

import {
  Dropdown, DropdownContent, DropdownItem, DropdownTrigger,
} from "@/components/forme/dropdown/dropdown";

<Dropdown>
  <DropdownTrigger>Options</DropdownTrigger>
  <DropdownContent align="end">
    <DropdownItem onClick={rename}>Rename</DropdownItem>
    <DropdownItem destructive onClick={remove}>Delete</DropdownItem>
  </DropdownContent>
</Dropdown>

When to use

Reach for it

  • A short list of actions behind one trigger: a row's options, an account menu.
  • Toggling options with DropdownCheckboxItem.

Use something else

  • Choosing a value for a form field — that is a Select.
  • Searching a long list of commands; use the CommandMenu.

API reference

Read from the source, so it is the API of the file you install. A prop marked * is required.

DropdownTrigger

PropTypeDefaultDescription
asChildboolean—Render as the single child element instead of a <button>, keeping the trigger behaviour.

Also takes every prop of Base UI Menu.Trigger.

DropdownItem

PropTypeDefaultDescription
destructiveboolean—Renders destructive: a red item for an action that cannot be undone.

Also takes every prop of Base UI Menu.Item.

DropdownCheckboxItem

PropTypeDefaultDescription
iconReact.ReactNode—Shown in the indicator slot when the item is checked.

Also takes every prop of Base UI Menu.CheckboxItem.

The other parts

  • DropdownTakes Base UI Menu.Root
  • DropdownContentTakes Base UI Menu.Popup and Pick<ComponentProps<typeof MenuPrimitive.Positioner>, "side" | "sideOffset" | "align">
  • DropdownLabelTakes Base UI Menu.GroupLabel
  • DropdownGroupTakes Base UI Menu.Group
  • DropdownSeparatorTakes Base UI Menu.Separator

Accessibility

  • Base UI handles roving focus, typeahead, aria-expanded and Esc, and returns focus to the trigger.
  • A destructive item is coloured and still announced by its label, so the meaning never rests on colour alone.

Motion

  • The menu grows from its trigger (--transform-origin) with a slight scale and blur, and exits faster than it enters.

Responsive behaviour

  • It is portalled and repositions to stay on screen near the edges.