NAVIGATION
ContextMenu
Right-click menu built on Radix ContextMenu. Mirrors DropdownMenu in API and item types — the difference is the trigger: any wrapped element opens on contextmenu events (right click, long press on touch, Shift-F10).
Import
Basic usage — right-click the area below
Right-click on me
Props
ContextMenu props
| Prop | Type | Default | Description |
|---|---|---|---|
| modal | boolean | true | Trap focus while the menu is open. Set false to allow interaction with the rest of the page. |
| onOpenChange | (open: boolean) => void | — | Fires when the menu opens or closes. |
When to use
- File managers, table rows, canvas elements — anywhere users expect a right-click menu of contextual actions.
- Don't replace primary affordances with ContextMenu only — touch users on iOS discover them via long-press, but Android contexts are spotty. Always provide an equivalent action via a button or DropdownMenu.
Accessibility
- Radix wires
role="menu"+role="menuitem"the same way DropdownMenu does, including support for checkbox / radio items. - Keyboard: Shift + F10 opens the menu from the focused trigger. Arrows cycle items; Esc closes.