Context Menu
A right-click menu that springs open from the exact cursor point and flips to stay inside the viewport, with icons, shortcuts, and destructive actions.
quarterly-report.pdf
Right-click for actions
Installation
pnpm dlx shadcn@latest add "https://godui.design/r/context-menu.json"Usage
tsx
import { ContextMenu } from "@/components/godui/context-menu";tsx
const items = [
{ label: "Copy", shortcut: "⌘C", onSelect: () => {} },
{ type: "separator" },
{ label: "Delete", destructive: true, onSelect: () => {} },
];
<ContextMenu items={items}>
<YourTargetArea />
</ContextMenu>;Props
| Prop | Type | Default | Description |
|---|---|---|---|
items | ContextMenuItem[] | — | Items, separators, and labels |
children | ReactNode | — | The area that responds to right-click |