Context Menu
stableA menu triggered by right-click or long-press.
Basic usage
Right-click here
Examples
Rich context menu
Include labels, separators, and checkbox items.
Right-click for actions
File context menu
ContextMenu supports nested actions, checkboxes and radio groups from a right-click surface.
Right-click a file row
Features
- Submenus, checkable items.
- Full keyboard navigation.
Installation
bash
pnpm dlx structyl add context-menuAPI Reference
ContextMenu.Root
Contains all context-menu parts.
| Prop | Type | Default |
|---|---|---|
| onOpenChange | (open: boolean) => voidCalled when open state changes. | — |
| modal | booleanWhether outside interaction is disabled. | true |
ContextMenu.Trigger
The area that opens the menu on right-click / long-press.
| Prop | Type | Default |
|---|---|---|
| disabled | booleanDisable triggering. | false |
ContextMenu.Content
The menu surface, positioned at the cursor.
| Prop | Type | Default |
|---|
ContextMenu.Item
A selectable item.
| Prop | Type | Default |
|---|---|---|
| onSelect | (event: Event) => voidCalled on selection. | — |
| disabled | booleanDisable the item. | — |