Context Menu
Right-click (or long-press on touch) menu anchored to the trigger region. Same item vocabulary as DropdownMenu.
Right-click (or long-press) here
Installation
pnpm
pnpm dlx @hex-core/cli add context-menuAPI Reference
| Prop | Type | Default | Description |
|---|---|---|---|
onOpenChange | function | — | Callback on open change |
modal | boolean | true | When true, interaction outside is blocked |
dir | "ltr" | "rtl" | — | Reading direction |
AI Guidance
When to use
Use for right-click menus on a specific region: file-manager-style actions, canvas/editor context actions, row-level actions in tables.
When not to use
Don't use for actions triggered by a button (use DropdownMenu). Don't use as the only way to access an action — must have a keyboard/button alternative.
Common mistakes
- Using ContextMenu as the only affordance (unreachable on touch)
- Triggering on the whole document (put it on a specific region)
- Missing a keyboard alternative for items
Accessibility
Triggered via right-click or Shift+F10 on keyboard. Radix handles role='menu', aria-labelledby, focus management.
Related components
Token budget: 700