Skip to content

Components · Overlays

DropdownMenu

Action menu with checkbox, radio and nested items.

@rookcom/monarch-reactComponent

Actions

Usage examples

Destructive item with icons

Purpose

A list of actions or options that opens from a trigger button.

Use when

  • Several related actions behind one button ("Actions", "…").

Avoid when

  • Choosing a form value: use Select or Combobox.

Design principles

  • tone="danger" for destructive items, paired with a confirmation step (ConfirmDialog). The whole item, icon included, takes the danger colour, so the tone does not rely on the label alone.
  • Destructive items go last, after a separator, so they are not hit by accident.
  • Shortcut hints are display only; the app binds the keys.

API reference

import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger } from '@rookcom/monarch-react';
ExportKindRenderingRoot class
DropdownMenucomponentclient.mn-menu
DropdownMenuCheckboxItemcomponentclient.mn-menu
DropdownMenuContentcomponentclient.mn-menu
DropdownMenuGroupcomponentclient.mn-menu
DropdownMenuItemcomponentclient.mn-menu
DropdownMenuLabelcomponentclient.mn-menu
DropdownMenuRadioGroupcomponentclient.mn-menu
DropdownMenuRadioItemcomponentclient.mn-menu
DropdownMenuSeparatorcomponentclient.mn-menu
DropdownMenuSubcomponentclient.mn-menu
DropdownMenuSubContentcomponentclient.mn-menu
DropdownMenuSubTriggercomponentclient.mn-menu
DropdownMenuTriggercomponentclient.mn-menu

Root, Trigger, Group, RadioGroup and Sub are the Radix DropdownMenu parts.

Content defaults to align="start" and sideOffset={4} and renders in a portal.

With asChild, DropdownMenuItem renders its child (for example a link) and ignores icon and shortcut.

Generated from the TypeScript declarations of packages/react/src/components/overlays/dropdown-menu.

Properties

DropdownMenu

Action menu. Arrow keys move, typeahead jumps, Escape closes and restores focus.

PropTypeDescription
childrenReact.ReactNode

DropdownMenuCheckboxItem

PropTypeDescription
asChildboolean
childrenReactNode
classNamestring
disabledboolean
idstring

DropdownMenuContent

PropTypeDescription
asChildboolean
childrenReactNode
classNamestring
idstring

DropdownMenuGroup

PropTypeDescription
asChildboolean
childrenReactNode
classNamestring
idstring

DropdownMenuItem

PropTypeDescription
asChildboolean
childrenReactNode
classNamestring
disabledboolean
iconReactNode
idstring
shortcutstringKeyboard shortcut hint, e.g. "⌘D". Display only.
tone"danger" | "default"`danger` for destructive actions. Pair with a confirmation step.

DropdownMenuLabel

PropTypeDescription
asChildboolean
childrenReactNode
classNamestring
idstring

DropdownMenuRadioGroup

PropTypeDescription
asChildboolean
childrenReactNode
classNamestring
idstring

DropdownMenuRadioItem

PropTypeDescription
asChildboolean
childrenReactNode
classNamestring
disabledboolean
idstring

DropdownMenuSeparator

PropTypeDescription
asChildboolean
childrenReactNode
classNamestring
idstring

DropdownMenuSub

PropTypeDescription
childrenReact.ReactNode

DropdownMenuSubContent

PropTypeDescription
asChildboolean
childrenReactNode
classNamestring
idstring

DropdownMenuSubTrigger

PropTypeDescription
asChildboolean
childrenReactNode
classNamestring
disabledboolean
idstring

DropdownMenuTrigger

PropTypeDescription
asChildboolean
childrenReactNode
classNamestring
disabledboolean
idstring

Variants

PropValuesDescription
tone (DropdownMenuItem)'default''danger'Exposed as data-tone. danger colours the label and icon with the danger text token and highlights with the danger surface.

States

StateExposed asBehaviour
Highlighteddata-highlightedItem under focus or pointer.
Disableddata-disabledSkipped by keyboard navigation.
Checked–Checkbox and radio items show a check or dot indicator.

Interaction behaviour

  • Selecting an item calls onSelect and closes the menu.
  • Sub-menus open from DropdownMenuSubTrigger.
  • To confirm a destructive item, open a ConfirmDialog from its onSelect; the menu closes first and the dialog returns focus to the menu trigger.
  • Controlled with open + onOpenChange, or uncontrolled (defaultOpen).

Keyboard support

KeysAction
Enter / Space / ArrowDownOn the trigger, opens the menu and focuses the first item.
ArrowDown / ArrowUpMoves between items.
TypeaheadJumps to the item starting with the typed text.
ArrowRight / ArrowLeftOpens or closes a sub-menu.
EnterSelects the focused item.
EscapeCloses the menu and restores focus to the trigger.

Accessibility

Role
menu, menuitem, menuitemcheckbox, menuitemradio
Accessible name
The trigger’s label.
  • Item icons and shortcut hints are aria-hidden.
  • A destructive item is not announced as such by tone alone: name the action clearly ("Delete ticket").

Responsive behaviour

  • Menus are at least 12rem and at most min(22rem, 100vw - 2rem) wide, so they fit a 320px screen.
  • Radix flips the menu to the other side and shifts it along the edge when it would leave the viewport (avoidCollisions, on by default); pass collisionPadding to keep a margin.
  • Items are at least --mn-control-sm tall.

Theme support

  • Styles are the shared .mn-menu rules in styles/menu.css (also used by Select and Combobox); semantic tokens only.

Do and don't

  • Label the trigger with what the menu is about.
  • Group items with labels and separators.
  • Do not put form inputs inside a menu.
  • Do not rely on the shortcut hint to bind keys.
  • Do not run an irreversible action straight from a menu item without a confirmation.
  • Select: Choosing one value for a form field.
  • Popover: Arbitrary floating content.
  • Breadcrumb: Uses a DropdownMenu for collapsed levels.
  • ConfirmDialog: The confirmation step for a destructive item.

Dependencies

KindDepends on
npm packages@radix-ui/react-dropdown-menureact
Monarch componentsNone

Testing coverage

  • Opens from the keyboard and focuses the first item; ArrowDown moves; Enter selects and closes.
  • No axe violations in the open menu (jsdom).
  • Destructive items expose data-tone="danger", hide their icon from assistive technology, are reached with End and selected with Enter.
  • Renders on the server (closed).
CheckCovered
Axe in jsdomYes
Server renderingYes
Browser suitesVisual baselines: gallery/dropdown-menu, overlays/menu-light (open) and overlays/menu-danger-light-390 (open, phone width); Cross-browser axe: /components/dropdown-menu

Tests: packages/react/src/components/overlays/dropdown-menu