Components · Overlays
Context Menu
StableAdded v0.0.1
A menu that opens at the pointer on right-click (or long-press), built on Radix.
import { ContextMenu } from '@nexub/react';Usage
Use it for
Shortcuts to actions on an item: rename, duplicate, delete
Use something else for
The only way to reach an action: right-click is hard to discover and needs a visible alternative, such as a `DropdownMenu`
Examples
Default
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| ContextMenu.Root | compound | — | Holds the open state (onOpenChange, modal). |
| ContextMenu.Trigger | compound | — | The area that opens the menu on right-click. Use asChild to make your element the area. |
| ContextMenu.Portal / Content | compound | — | Renders the floating menu in a portal. |
| ContextMenu.Item | compound | — | An action (onSelect, disabled). |
| ContextMenu.CheckboxItem / RadioGroup / RadioItem | compound | — | Toggle and single-choice items (checked, onCheckedChange; value, onValueChange). |
| ContextMenu.Label / Group / Separator | compound | — | Section heading, grouping and divider. |
| ContextMenu.Sub / SubTrigger / SubContent | compound | — | A nested submenu. |
Accessibility
ARIA roles
menumenuitemmenuitemcheckboxmenuitemradio
Keyboard
- Shift + F10 / Menu key
Opens the menu from the focused trigger.
- Arrow Up / Down
Moves between items.
- Enter / Space
Activates the item.
- Escape
Closes the menu.
On iOS & Android
Web only
Context Menu has no @nexub/react-native twin. On phones, follow the platform pattern instead, or compose it from the native components listed on the React Native page.