Clinia UI

Dropdown Menu

A list of actions that opens from a button.

shadcn docs →

When to use

  • Secondary actions for one object, behind a single trigger: rename, duplicate, or archive a source.
  • Actions that don't fit in a toolbar or a table row.

When not to use

  • Picking a value in a form: use Select or Combobox.
  • Moving between pages of the app: use Navigation Menu or Sidebar.
  • The main action of a view: show it as a Button.
  • Searching a long list of actions: use Command.

Install

npx shadcn@latest add @clinia/dropdown-menu

Anatomy

  1. 1Menudata-slot="dropdown-menu-content"bg-popover · rounded-lg · p-1.5
  2. 2Group labeldata-slot="dropdown-menu-label"text-xs · text-muted-foreground
  3. 3Itemdata-slot="dropdown-menu-item"text-sm · font-medium
  4. 4Shortcutdata-slot="dropdown-menu-shortcut"text-xs · text-muted-foreground
  5. 5Separatordata-slot="dropdown-menu-separator"bg-foreground/5
  6. 6Destructive item, last[data-slot=dropdown-menu-item][data-variant=destructive]text-destructive

Clinia rules

  • The highlighted item is bg-foreground/4, the ink tint every hover and keyboard highlight uses, with text-popover-foreground.
  • destructive is for delete, revoke, and remove: red text and a red tint. Not for archive or sign out, which lose nothing. Put destructive items last, after a separator.
  • Item labels are sentence case and start with a verb: Rename source, Copy API key.
  • DropdownMenuLabel names a group in text-xs text-muted-foreground. It is never clickable.

Do and don't

Do keep the main action visible and put the rest behind one labelled trigger.
Don't hide the main action inside a menu.

States

highlighted item
destructive · last
destructive · highlighted
label · checkbox · radio
disabled item · shortcut

Toggle the site theme to review both themes.

Accessibility

Built in

  • Arrow keys move the highlight and loop at the ends. Escape closes the menu and returns focus to the trigger.
  • Arrow Right opens a submenu and Arrow Left closes it.
  • Checkbox and radio items announce their checked state.

Your responsibility

  • Label an icon-only trigger with its object: aria-label="Actions for Montreal clinic", not just More.
  • Use DropdownMenuCheckboxItem or DropdownMenuRadioItem for state, never a check icon inside a plain item.
  • Keep menus to actions. Inputs and forms belong in a Popover or a Dialog.

How to test

  1. Press Tab to reach the trigger, then Enter or Space: the menu opens and focus moves into it.
  2. Press Arrow Down and Arrow Up: the highlight moves and wraps at the ends.
  3. Press Enter on an item: it runs and the menu closes.
  4. Open it again and press Escape: it closes and focus returns to the trigger.
  5. With a screen reader, the trigger announces its label, and each item is announced as a menu item.

API

DropdownMenuLabel

PropValuesDefaultDescription
inset
boolean
–

Indents the label to line up with items that have an icon or an indicator.

DropdownMenuItem

PropValuesDefaultDescription
inset
boolean
–

Indents the item to line up with siblings that have an icon or an indicator.

variant
defaultdestructive
default

destructive for delete, revoke, and remove: red text and a red highlight. Not for archive or sign out, which lose nothing.

DropdownMenuCheckboxItem

PropValuesDefaultDescription
inset
boolean
–

Indents the item to line up with siblings that have an icon or an indicator.

DropdownMenuRadioItem

PropValuesDefaultDescription
inset
boolean
–

Indents the item to line up with siblings that have an icon or an indicator.

DropdownMenuSubTrigger

PropValuesDefaultDescription
inset
boolean
–

Indents the item to line up with siblings that have an icon or an indicator.

All other props come from Base UI Menu.