Primitives
Primitive

Context Menu

Right-click menu that displays contextual actions for specific elements

The context menu opens on right-click and lists actions scoped to the element under the cursor. Use it for row actions in a table, canvas or editor commands, or any desktop-style secondary menu; for a button-triggered menu, use Dropdown Menu instead.

Preview

Right click here

Installation

Usage

Composition

Examples

With Submenus

Nest a ContextMenuSub to open a second menu from a trigger item.

Right click here

With Separators and Shortcuts

Use ContextMenuSeparator to divide groups and ContextMenuShortcut to show key hints.

Right click here

With Checkboxes and Radio Groups

Use ContextMenuCheckboxItem for toggles and ContextMenuRadioGroup for single-choice options. Both put their indicator in a reserved column on the right, so labels stay put as items toggle.

Right click here

With Switch

Set indicator="switch" on ContextMenuCheckboxItem to swap the checkmark for a switch. Visual only: the item keeps its menuitemcheckbox role, the row stays the click target, and the menu stays open on toggle.

Right click here

API Reference

ContextMenuContent

Prop

ContextMenuItem

Prop
ValueDescription
defaultA standard menu action.
destructiveA dangerous action such as delete or remove.

ContextMenuLinkItem

Menu item that renders as an anchor (<a>) for navigation links. Wraps Base UI's ContextMenu.LinkItem.

Prop

ContextMenuCheckboxItem

Toggleable menu item. Wraps Base UI's ContextMenu.CheckboxItem. The indicator sits in a reserved column on the right.

Prop

ContextMenuRadioItem

Mutually exclusive menu item. Wraps Base UI's ContextMenu.RadioItem. Uses the same right-aligned checkmark as ContextMenuCheckboxItem.

Prop

ContextMenuLabel

Prop

ContextMenuGroupLabel

Prop

ContextMenuSubTrigger

Prop

ContextMenuSubContent

Prop

Additional Props

ContextMenu components inherit all props from Base UI Context Menu, including open, defaultOpen, onOpenChange, positioning options, and accessibility props.