Skip to content

Dropdown menu

A list of actions that opens from a button.

Dropdown menuLive · light and dark follow the theme switch

Add the source to a shadcn project

npx shadcn@latest add https://docs.atomus.io/r/dropdown-menu.jsonOpen in v0

Installs the component source, its CSS and the Atomus tokens into components/atomus/. How the registry works

From guidelines/components/menu.md · Open in Figma: DropdownMenu · MenuItem

Properties, variants and anatomy of the Figma components. React props use the same names.

Floating menu; items live in a slot.

Variants: 1

Property Type / options
Items slot (any content)

Row for dropdowns, selects, context and command menus.

Variants: 8

Property Type / options
Label text
Leading icon boolean (on)
Leading icon swap instance swap (icon)
Shortcut boolean (off)
Shortcut text text
Size sm · md
State Default · Hover · Selected · Disabled

Right-click menu with shortcuts, separators, destructive item and submenus.

Variants: 2

Property Type / options
Type Default · Submenu open
import { DropdownMenu, MenuItem } from '@stanvision/atomus-react';
<DropdownMenu
label="Project actions"
trigger={<Button hierarchy="outline">Actions</Button>}
items={[
{ label: 'Rename', shortcut: '⌘R', onSelect: rename },
{ type: 'separator' },
{ label: 'Delete', destructive: true, onSelect: remove },
]}
/>

A list of actions that opens from a button. MenuItem is exported for custom lists.

Full types and defaults are in React API at the end of the page.

  • trigger — the button that opens it (it gets aria-haspopup, aria-expanded and arrow-key opening).
  • items — { label, icon?, shortcut?, disabled?, destructive?, onSelect }, { type: 'separator' } or { type: 'heading', label }.
  • align start · end; size sm 36 · md 40; label names the menu.

Do

  • Put destructive actions last, after a separator.

Don’t

  • Don’t use it to pick a value — that’s Select.

From the Figma guidelines.

Do

  • Drop Menu items into the Items slot.
  • Group related items with separators and headings.
  • Show keyboard shortcuts for power users.

Forbidden

  • Never exceed about ten items — use Command menu.
  • Never put forms inside menus.
  • Never run a destructive item without a confirmation.

Do

  • Mirror actions that also exist elsewhere in the UI; put destructive items last, in red.

Forbidden

  • Never hide an action only in a context menu.

Generated from react/src/components by scripts/gen-react-api.mjs — the same tables agents read in guidelines/components/menu.md.

Use only these props; anything else is not part of the API.

Figma: Dropdown menu / Context menu — keyboard: ↑ ↓ Home End Enter Esc.

import { DropdownMenu } from '@stanvision/atomus-react'; — source: react/src/components/Menu.tsx

Prop Type Default Description
trigger ReactElement required The element that opens the menu, usually a Button
items DropdownItem[] required Figma: Items slot
align 'start' | 'end' 'start' Alignment.
size 'sm' | 'md' 'sm' Size.
label string — Accessible name for the menu
defaultOpen boolean — Start open (docs and tests)
className string — Extra class on the root element (layout only — never restyle colours or sizes).

Accepts only the props above.

DropdownItem:

type DropdownItem =
| { type?: 'item'; label: ReactNode; icon?: ReactNode; shortcut?: string; disabled?: boolean; destructive?: boolean; onSelect?: () => void }
| { type: 'separator' }
| { type: 'heading'; label: ReactNode };

Figma: Menu item — row for dropdowns, selects, context and command menus.

import { MenuItem } from '@stanvision/atomus-react'; — source: react/src/components/Menu.tsx

Prop Type Default Description
label ReactNode required Figma: Label
icon ReactNode — Figma: Leading icon + Leading icon swap
shortcut string — Figma: Shortcut + Shortcut text
size 'sm' | 'md' 'sm' Figma: Size — sm 32 · md 40
selected boolean — Figma: State=Selected — shows a check
disabled boolean — Disables the control.
destructive boolean — Red label for destructive actions (Context menu)
onSelect () => void — Called when the item is chosen.
role 'menuitem' | 'option' | 'menuitemcheckbox' 'menuitem' ARIA role.
id string — Element id; generated when omitted (wires label and hint).
active boolean — Highlighted by keyboard navigation.

Accepts only the props above.