Components/Context Menu
Context Menu
A menu that appears on right-click (or long-press on touch). The menu is positioned at the click point.
Right-click here
Installation
npx ajaxui add context-menuNotes
Anatomy
<ContextMenu> // right-click state owner
<ContextMenuTrigger/> // wraps the area that gets the menu
<ContextMenuContent>
<ContextMenuItem/>
<ContextMenuSeparator/>
<ContextMenuSub>
<ContextMenuSubTrigger/>
<ContextMenuSubContent/>
</ContextMenuSub>
</ContextMenuContent>
</ContextMenu>Props
| Prop | Type | Default | Description |
|---|---|---|---|
| asChild | boolean (on Trigger) | — | Forwards onContextMenu to the child element. |
| disabled | boolean (on Item) | — | Disables an item. |
| destructive | boolean (on Item) | — | Highlights destructive actions in red. |
| onSelect | () => void (on Item) | — | — |