Action menu with checkbox, radio and nested items.
@rookcom/monarch-reactComponent
Actions
import{ Button, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger }from'@rookcom/monarch-react';// MoreIcon: demo icon from the docs site; use your own.<DropdownMenu><DropdownMenuTrigger asChild><ButtontrailingIcon={<MoreIcon />}>Actions</Button></DropdownMenuTrigger><DropdownMenuContent><DropdownMenuLabel>Ticket</DropdownMenuLabel><DropdownMenuItemshortcut="R">Rename</DropdownMenuItem><DropdownMenuItem>Assign to me</DropdownMenuItem><DropdownMenuCheckboxItem checked>Watching</DropdownMenuCheckboxItem><DropdownMenuSeparator/><DropdownMenuItemtone="danger">Delete</DropdownMenuItem></DropdownMenuContent></DropdownMenu>
Usage examples
Destructive item with icons
import{ Button, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger }from'@rookcom/monarch-react';// PencilIcon, TrashIcon: demo icons from the docs site; use your own.<DropdownMenu><DropdownMenuTrigger asChild><Button>Document</Button></DropdownMenuTrigger><DropdownMenuContent><DropdownMenuItemicon={<PencilIcon />}shortcut="E">
Edit
</DropdownMenuItem><DropdownMenuSeparator/><DropdownMenuItemtone="danger"icon={<TrashIcon />}>
Move to trash
</DropdownMenuItem></DropdownMenuContent></DropdownMenu>
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.
`danger` for destructive actions. Pair with a confirmation step.
DropdownMenuLabel
Prop
Type
Description
asChild
boolean
children
ReactNode
className
string
id
string
DropdownMenuRadioGroup
Prop
Type
Description
asChild
boolean
children
ReactNode
className
string
id
string
DropdownMenuRadioItem
Prop
Type
Description
asChild
boolean
children
ReactNode
className
string
disabled
boolean
id
string
DropdownMenuSeparator
Prop
Type
Description
asChild
boolean
children
ReactNode
className
string
id
string
DropdownMenuSub
Prop
Type
Description
children
React.ReactNode
DropdownMenuSubContent
Prop
Type
Description
asChild
boolean
children
ReactNode
className
string
id
string
DropdownMenuSubTrigger
Prop
Type
Description
asChild
boolean
children
ReactNode
className
string
disabled
boolean
id
string
DropdownMenuTrigger
Prop
Type
Description
asChild
boolean
children
ReactNode
className
string
disabled
boolean
id
string
Variants
Prop
Values
Description
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
State
Exposed as
Behaviour
Highlighted
data-highlighted
Item under focus or pointer.
Disabled
data-disabled
Skipped 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
Keys
Action
Enter / Space / ArrowDown
On the trigger, opens the menu and focuses the first item.
ArrowDown / ArrowUp
Moves between items.
Typeahead
Jumps to the item starting with the typed text.
ArrowRight / ArrowLeft
Opens or closes a sub-menu.
Enter
Selects the focused item.
Escape
Closes 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
Do
Label the trigger with what the menu is about.
Group items with labels and separators.
Don't
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.