Context Menu
Menu of actions opened by right-click or long pressDisplays a menu of actions at the pointer when the user right-clicks, or long-presses on touch devices. Use context menus for shortcuts to actions that are also available elsewhere in the interface.
This component is built on Radix UI Context Menu. For the full primitive API reference, see the Radix documentation.
Installation
Usage
Anatomy
The context menu is composed of several parts:
Props
Root
Trigger
Content
Item
CheckboxItem
RadioGroup
RadioItem
Sub
SubContent
ContextMenu submenus always cascade. The submenuBehavior prop is accepted for backward compatibility and has no effect.
Variants
Solid Variant
The default. Highlighted items use a solid accent fill.
Soft Variant
Highlighted items use a soft accent tint for content-heavy interfaces.
Sizes
Size 1
Compact size for dense editors and canvases.
Size 2
Standard size for most interfaces.
Colors
Use the color prop on items to communicate intent. Destructive actions should use red or crimson.
Material
Solid Material
Opaque background for standard interfaces.
Translucent Material
Frosted glass for menus over images or canvases. Item text reads the strong ink by default.
States
Disabled Items
Disabled items stay visible but cannot be focused or selected. Their shortcut dims with them.
Examples
Toggle Options
Nested Actions
Submenus open to the side and inherit the parent's size, variant, color and material. Pass props to SubContent to override them.
Long Lists
Set virtualized and render a VirtualMenu for hundreds of items. Row heights follow the menu size and theme scaling.
Responsive
size accepts a responsive object. Submenus resolve it for the current breakpoint, so they stay aligned with their trigger.
Accessibility
Context Menu follows the WAI-ARIA Menu pattern.
Keyboard Navigation
Screen Readers
role="menu"on the content andmenuitem,menuitemcheckboxandmenuitemradioon itemsaria-checkedfor checkbox and radio items,aria-disabledfor disabled itemsaria-keyshortcutson items with ashortcut; the visual hint is hidden so it is not read as part of the item name
Trigger Content
Context menus are hidden by default. Make every action also reachable from a visible control, such as a toolbar button or a DropdownMenu.
Changelog
Added
virtualizedprop onContentandSubContentforVirtualMenuSubContentaccepts its ownsize,variant,colorandmaterial- Shortcuts are exposed as
aria-keyshortcuts
Fixed
submenuBehaviorno longer leaks to the DOM- A responsive
sizeno longer places the menu at the viewport origin - The first item lines up with the pointer at every size and scaling
- Menus follow a nested
Themematerial - Radio items show a dot indicator, like DropdownMenu
Removed
highContrastonContentandSubContent. A gray menu highlights with step 12 on its own, and item text reads the strong ink by default.
Deprecated
panelBackgroundprop in favor ofmaterialpropsubmenuBehavioronContent, which has no effect
© 2026 Kushagra Dhawan. Licensed under MIT. GitHub.