{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "context-menu",
  "type": "registry:ui",
  "title": "Context Menu",
  "description": "A menu of actions that opens at the pointer on right-click, and on a long press on touch screens: items, checkbox and radio items, labels, separators, sub-menus and a shortcut slot.",
  "categories": [
    "ui"
  ],
  "dependencies": [
    "lucide-react",
    "radix-ui"
  ],
  "registryDependencies": [
    "@rivier-ui/theme",
    "@rivier-ui/cn"
  ],
  "files": [
    {
      "path": "registry/ui/context-menu.tsx",
      "type": "registry:ui",
      "target": "components/ui/context-menu.tsx",
      "content": "\"use client\";\n/**\n * @name context-menu\n * @category ui\n * @description A menu of actions that opens at the pointer on right-click, and on a long press on touch screens: items, checkbox and radio items, labels, separators, sub-menus and a shortcut slot.\n * @when Shortcuts to actions on a thing in a dense interface (a file, a row, a canvas object). Nothing shows that it exists, so every action in it must also be reachable another way; for a visible button use dropdown-menu.\n * @example\n * <ContextMenu>\n *   <ContextMenuTrigger className=\"flex h-32 items-center justify-center rounded-surface border border-dashed text-sm\">\n *     Right-click, or press and hold\n *   </ContextMenuTrigger>\n *   <ContextMenuContent>\n *     <ContextMenuItem>Open <ContextMenuShortcut>Enter</ContextMenuShortcut></ContextMenuItem>\n *     <ContextMenuCheckboxItem checked>Pinned</ContextMenuCheckboxItem>\n *     <ContextMenuSub>\n *       <ContextMenuSubTrigger>Label</ContextMenuSubTrigger>\n *       <ContextMenuSubContent>\n *         <ContextMenuRadioGroup value=\"none\">\n *           <ContextMenuRadioItem value=\"none\">None</ContextMenuRadioItem>\n *           <ContextMenuRadioItem value=\"urgent\">Urgent</ContextMenuRadioItem>\n *         </ContextMenuRadioGroup>\n *       </ContextMenuSubContent>\n *     </ContextMenuSub>\n *     <ContextMenuSeparator />\n *     <ContextMenuItem variant=\"destructive\">Delete</ContextMenuItem>\n *   </ContextMenuContent>\n * </ContextMenu>\n */\nimport { ContextMenu as ContextMenuPrimitive } from \"radix-ui\";\nimport { Check, ChevronRight, Circle } from \"lucide-react\";\nimport type { ComponentProps } from \"react\";\nimport { cn } from \"@/lib/cn\";\n\n/* The highlight (Radix's data-highlighted, which follows both pointer and keyboard) is the ground; the theme's\n   focus ring stays for keyboard users and is drawn inside the item so the menu's edge does not clip it. */\nconst item =\n  \"relative flex min-h-9 cursor-default items-center gap-2 rounded-control px-2.5 py-1.5 text-sm select-none -outline-offset-2 data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-accent data-highlighted:text-accent-foreground pointer-coarse:min-h-10 [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\";\n\n/* The menu opens at the pointer, so it only fades and scales from that corner: there is no side to slide from. */\nconst surface =\n  \"z-50 max-h-(--radix-context-menu-content-available-height) min-w-40 max-w-(--radix-context-menu-content-available-width) origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-surface border bg-popover p-1 text-popover-foreground ease-out animation-duration-(--duration-base) fade-in-0 fade-out-0 zoom-in-95 zoom-out-95 data-[state=closed]:animate-out data-[state=open]:animate-in motion-reduce:animate-none!\";\n\nexport function ContextMenu(props: ComponentProps<typeof ContextMenuPrimitive.Root>) {\n  return <ContextMenuPrimitive.Root {...props} />;\n}\n\n/** The area that answers to right-click and long press. Renders a span: give it layout classes, or use `asChild`. */\nexport function ContextMenuTrigger(props: ComponentProps<typeof ContextMenuPrimitive.Trigger>) {\n  return <ContextMenuPrimitive.Trigger data-slot=\"context-menu-trigger\" {...props} />;\n}\n\nexport function ContextMenuContent({ className, collisionPadding = 8, ...props }: ComponentProps<typeof ContextMenuPrimitive.Content>) {\n  return (\n    <ContextMenuPrimitive.Portal>\n      <ContextMenuPrimitive.Content data-slot=\"context-menu-content\" collisionPadding={collisionPadding} className={cn(surface, className)} {...props} />\n    </ContextMenuPrimitive.Portal>\n  );\n}\n\nexport function ContextMenuGroup(props: ComponentProps<typeof ContextMenuPrimitive.Group>) {\n  return <ContextMenuPrimitive.Group data-slot=\"context-menu-group\" {...props} />;\n}\n\nexport type ContextMenuItemProps = ComponentProps<typeof ContextMenuPrimitive.Item> & {\n  /** Indent to line up with checkbox and radio items in the same menu. */\n  inset?: boolean;\n  /** \"destructive\" only for deleting. */\n  variant?: \"default\" | \"destructive\";\n};\n\nexport function ContextMenuItem({ className, inset = false, variant = \"default\", ...props }: ContextMenuItemProps) {\n  return (\n    <ContextMenuPrimitive.Item\n      data-slot=\"context-menu-item\"\n      data-variant={variant}\n      className={cn(item, inset && \"ps-8\", variant === \"destructive\" && \"text-destructive data-highlighted:text-destructive\", className)}\n      {...props}\n    />\n  );\n}\n\nexport function ContextMenuCheckboxItem({ className, children, ...props }: ComponentProps<typeof ContextMenuPrimitive.CheckboxItem>) {\n  return (\n    <ContextMenuPrimitive.CheckboxItem data-slot=\"context-menu-checkbox-item\" className={cn(item, \"ps-8\", className)} {...props}>\n      <span aria-hidden=\"true\" className=\"pointer-events-none absolute start-2.5 flex size-4 items-center justify-center\">\n        <ContextMenuPrimitive.ItemIndicator>\n          <Check strokeWidth={1.5} className=\"size-4\" />\n        </ContextMenuPrimitive.ItemIndicator>\n      </span>\n      {children}\n    </ContextMenuPrimitive.CheckboxItem>\n  );\n}\n\nexport function ContextMenuRadioGroup(props: ComponentProps<typeof ContextMenuPrimitive.RadioGroup>) {\n  return <ContextMenuPrimitive.RadioGroup data-slot=\"context-menu-radio-group\" {...props} />;\n}\n\nexport function ContextMenuRadioItem({ className, children, ...props }: ComponentProps<typeof ContextMenuPrimitive.RadioItem>) {\n  return (\n    <ContextMenuPrimitive.RadioItem data-slot=\"context-menu-radio-item\" className={cn(item, \"ps-8\", className)} {...props}>\n      <span aria-hidden=\"true\" className=\"pointer-events-none absolute start-2.5 flex size-4 items-center justify-center\">\n        <ContextMenuPrimitive.ItemIndicator>\n          <Circle strokeWidth={1.5} className=\"size-2 fill-current\" />\n        </ContextMenuPrimitive.ItemIndicator>\n      </span>\n      {children}\n    </ContextMenuPrimitive.RadioItem>\n  );\n}\n\nexport function ContextMenuLabel({ className, inset = false, ...props }: ComponentProps<typeof ContextMenuPrimitive.Label> & { inset?: boolean }) {\n  return (\n    <ContextMenuPrimitive.Label\n      data-slot=\"context-menu-label\"\n      className={cn(\"px-2.5 py-1.5 text-xs font-medium text-muted-foreground\", inset && \"ps-8\", className)}\n      {...props}\n    />\n  );\n}\n\nexport function ContextMenuSeparator({ className, ...props }: ComponentProps<typeof ContextMenuPrimitive.Separator>) {\n  return <ContextMenuPrimitive.Separator data-slot=\"context-menu-separator\" className={cn(\"-mx-1 my-1 h-px bg-border\", className)} {...props} />;\n}\n\n/** A keyboard hint at the end of an item. It only shows the keys: bind them yourself. */\nexport function ContextMenuShortcut({ className, ...props }: ComponentProps<\"span\">) {\n  return <span data-slot=\"context-menu-shortcut\" className={cn(\"ms-auto ps-4 text-xs tracking-widest text-muted-foreground\", className)} {...props} />;\n}\n\nexport function ContextMenuSub(props: ComponentProps<typeof ContextMenuPrimitive.Sub>) {\n  return <ContextMenuPrimitive.Sub {...props} />;\n}\n\nexport function ContextMenuSubTrigger({ className, inset = false, children, ...props }: ComponentProps<typeof ContextMenuPrimitive.SubTrigger> & { inset?: boolean }) {\n  return (\n    <ContextMenuPrimitive.SubTrigger\n      data-slot=\"context-menu-sub-trigger\"\n      className={cn(item, \"data-[state=open]:bg-accent\", inset && \"ps-8\", className)}\n      {...props}\n    >\n      {children}\n      <ChevronRight aria-hidden=\"true\" strokeWidth={1.5} className=\"ms-auto size-4 rtl:rotate-180\" />\n    </ContextMenuPrimitive.SubTrigger>\n  );\n}\n\nexport function ContextMenuSubContent({ className, collisionPadding = 8, ...props }: ComponentProps<typeof ContextMenuPrimitive.SubContent>) {\n  return (\n    <ContextMenuPrimitive.Portal>\n      <ContextMenuPrimitive.SubContent data-slot=\"context-menu-sub-content\" collisionPadding={collisionPadding} className={cn(surface, className)} {...props} />\n    </ContextMenuPrimitive.Portal>\n  );\n}\n"
    }
  ],
  "meta": {
    "category": "ui",
    "when": "Shortcuts to actions on a thing in a dense interface (a file, a row, a canvas object). Nothing shows that it exists, so every action in it must also be reachable another way; for a visible button use dropdown-menu.",
    "example": "<ContextMenu>\n  <ContextMenuTrigger className=\"flex h-32 items-center justify-center rounded-surface border border-dashed text-sm\">\n    Right-click, or press and hold\n  </ContextMenuTrigger>\n  <ContextMenuContent>\n    <ContextMenuItem>Open <ContextMenuShortcut>Enter</ContextMenuShortcut></ContextMenuItem>\n    <ContextMenuCheckboxItem checked>Pinned</ContextMenuCheckboxItem>\n    <ContextMenuSub>\n      <ContextMenuSubTrigger>Label</ContextMenuSubTrigger>\n      <ContextMenuSubContent>\n        <ContextMenuRadioGroup value=\"none\">\n          <ContextMenuRadioItem value=\"none\">None</ContextMenuRadioItem>\n          <ContextMenuRadioItem value=\"urgent\">Urgent</ContextMenuRadioItem>\n        </ContextMenuRadioGroup>\n      </ContextMenuSubContent>\n    </ContextMenuSub>\n    <ContextMenuSeparator />\n    <ContextMenuItem variant=\"destructive\">Delete</ContextMenuItem>\n  </ContextMenuContent>\n</ContextMenu>",
    "client": true
  }
}
