Context Menu

A menu that opens on right click or long press.

Right-click hereor long-press on touch devices

Installation

  1. Add the registryOnce per project
  2. Add context-menu

Usage

ContextMenuTrigger wraps the area that opens the menu. Items work like those in a Dropdown Menu.

People won't always think to right-click, so make these actions available somewhere else too.

Composition

Examples

Nest a menu with ContextMenuSub, ContextMenuSubTrigger and ContextMenuSubContent.

Right-click here

Checkbox and radio items

Use ContextMenuCheckboxItem for toggles, and ContextMenuRadioItems inside a ContextMenuRadioGroup to pick one of several options.

Right-click here

Props

Items, labels and submenu triggers take inset to line up with items that have an icon.

The tables leave out className, style and render. Parts built on Base UI take them as its styling and composition guides describe.

ContextMenu

ContextMenuPortal

ContextMenuContent

ContextMenuGroup

ContextMenuLabel

ContextMenuItem

ContextMenuSub

ContextMenuSubTrigger

ContextMenuSubContent

ContextMenuCheckboxItem

ContextMenuRadioGroup

ContextMenuRadioItem

ContextMenuSeparator