ContextMenu

Right-click context menu anchored at pointer coordinates via CSS custom properties

Category: overlay · WCAG 2.2-AA · overlay, menu, context, right-click

States

Props

PropTypeDefaultDescription
childrenReact.ReactNodeThe right-click target first, followed by ContextMenuItem children.

Design tokens

When to use

When not to use

How to build an accessible ContextMenu in React →

Examples

Basic

<ContextMenu>
  <div>Right-click me</div>
  <ContextMenuItem onSelect={rename}>Rename</ContextMenuItem>
  <ContextMenuItem onSelect={remove}>Delete</ContextMenuItem>
</ContextMenu>

Disabled item

<ContextMenu>
  <FileRow file={file} />
  <ContextMenuItem onSelect={copy}>Copy</ContextMenuItem>
  <ContextMenuItem onSelect={paste} disabled>Paste</ContextMenuItem>
</ContextMenu>

Related components

← Back to docs