Context Menu
shadcn/ui
Right-click contextual menu. Power-user feature for table row actions, file operations.
@/components/ui/context-menuItem types — right-click the box
Right-click anywhere in this areaBookmark: unchecked · Pin: unchecked
In context — ticket table rows
| ID | Title | Status | Priority |
|---|---|---|---|
| T7A3763 | Fix login redirect | Open | High |
| T7A3801 | Update ticket filters | In Progress | Normal |
| T7A3820 | Export to CSV | In Review | Low |
Right-click any row to trigger the context menu.
Sub-components
| Component | Role |
|---|---|
| ContextMenu | Root — wraps trigger and content |
| ContextMenuTrigger | Right-click target area |
| ContextMenuContent | Menu panel — appears at cursor position |
| ContextMenuLabel | Non-clickable section header |
| ContextMenuItem | Clickable row — variant: "default" | "destructive" |
| ContextMenuCheckboxItem | Item with checkbox — checked + onCheckedChange |
| ContextMenuSeparator | Horizontal divider between groups |
| ContextMenuShortcut | Keyboard hint aligned to the right of the item |
| ContextMenuSub | Sub-menu root — wraps SubTrigger + SubContent |
| ContextMenuSubTrigger | Item that opens the sub-menu on hover |
| ContextMenuSubContent | Sub-menu panel |
ContextMenu vs DropdownMenu: same API, different trigger — right-click vs button click. Share the same sub-components pattern.
On this page