Skip to content

Context Menu

A context menu component for right-click actions

Installation

pnpm dlx shadcn@latest add https://ui.sanjid.shop/r/context-menu.json
PropTypeRequiredDefaultDescription
itemsarrayYescontext menu items = [ { id: string, label: string, icon?: React.ComponentType<{ className?: string }>, shortcut?: string, disabled?: boolean, onClick?: () => void, submenu?: ContextMenuItem[] } ]
onClosefunctionNoThe function to call when the context menu is closed
classNamestringNoThe class name to apply to the context menu for styling

Usage

1import { ContextMenu } from "@/components/ui/context-menu";
1const items = [2  {3    id: "copy",4    label: "Copy",5    icon: CopyIcon,6  },7  {8    id: "paste",9    label: "Paste",10    icon: PasteIcon,11  },12];13
14<ContextMenu items={items} />;

Build your next big idea with us

From lightning-fast landing pages to fully functional SaaS products, we turn your vision into reality. Book a call today and let's make something extraordinary.

They transformed our idea into a fully functional product in record time. Couldn't be happier!

Alex Chen

Founder, StartupX

The team's attention to detail and design expertise set our product apart in the market.

Sarah Kim

CTO, Innovate Inc