{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "brand-context-menu",
  "title": "Brand Context Menu",
  "description": "Share copy-ready and downloadable brand assets from a contextual menu.",
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [
    "context-menu",
    "https://tentui.com/r/copy-button.json"
  ],
  "files": [
    {
      "path": "src/registry/components/brand-context-menu/brand-context-menu.tsx",
      "content": "\"use client\";\n\nimport { DownloadIcon, TypeIcon } from \"lucide-react\";\nimport type { ReactElement, ReactNode } from \"react\";\nimport {\n\tContextMenu,\n\tContextMenuContent,\n\tContextMenuGroup,\n\tContextMenuItem,\n\tContextMenuSeparator,\n\tContextMenuTrigger,\n} from \"@/components/ui/context-menu\";\nimport { useCopyToClipboard } from \"@/hooks/use-copy-to-clipboard\";\nimport { CopyStateIcon } from \"@/registry/components/copy-button/copy-button\";\n\nexport type BrandAsset = {\n\tname: string;\n\tpath: string;\n\tfilename: string;\n};\n\nexport const BRAND_MARK_ASSET = {\n\tname: \"Mark\",\n\tpath: \"https://cdn.tentui.com/brand/mark-brand.svg\",\n\tfilename: \"tentui-mark.svg\",\n} as const satisfies BrandAsset;\n\nexport const BRAND_LOGOTYPE_ASSET = {\n\tname: \"Logotype\",\n\tpath: \"https://cdn.tentui.com/brand/LogoType.svg\",\n\tfilename: \"tentui-logotype.svg\",\n} as const satisfies BrandAsset;\n\nexport const BRAND_ASSETS = [\n\t{\n\t\tname: \"Logo\",\n\t\tpath: \"https://cdn.tentui.com/brand/Logo.svg\",\n\t\tfilename: \"tentui-logo.svg\",\n\t},\n\tBRAND_LOGOTYPE_ASSET,\n\tBRAND_MARK_ASSET,\n\t{\n\t\tname: \"Mark for light backgrounds\",\n\t\tpath: \"https://cdn.tentui.com/brand/mark-light.svg\",\n\t\tfilename: \"tentui-mark-light.svg\",\n\t},\n\t{\n\t\tname: \"Mark for dark backgrounds\",\n\t\tpath: \"https://cdn.tentui.com/brand/Mark-dark.svg\",\n\t\tfilename: \"tentui-mark-dark.svg\",\n\t},\n] as const satisfies readonly BrandAsset[];\n\nexport type BrandContextMenuProps = {\n\tchildren: ReactElement;\n\tmarkAsset?: BrandAsset;\n\tlogotypeAsset?: BrandAsset;\n\tbrandAssetsZipPath?: string;\n};\n\nasync function fetchSvg(asset: BrandAsset) {\n\tconst response = await fetch(asset.path);\n\n\tif (!response.ok) {\n\t\tthrow new Error(`Could not load ${asset.name.toLowerCase()}.`);\n\t}\n\n\treturn response.text();\n}\n\nfunction CopyAssetItem({\n\tasset,\n\tlabel,\n\ticon,\n}: {\n\tasset: BrandAsset;\n\tlabel: string;\n\ticon: ReactNode;\n}) {\n\t// closeOnClick is off so the menu stays open and the row shows its state.\n\tconst { state, copy } = useCopyToClipboard();\n\n\treturn (\n\t\t<ContextMenuItem\n\t\t\tcloseOnClick={false}\n\t\t\tclassName=\"h-9 rounded-lg px-2.5\"\n\t\t\tonClick={() => void copy(() => fetchSvg(asset))}\n\t\t>\n\t\t\t<CopyStateIcon state={state} idleIcon={icon} />\n\t\t\t{state === \"done\" ? \"Copied\" : state === \"error\" ? \"Copy failed\" : label}\n\t\t</ContextMenuItem>\n\t);\n}\n\nfunction BrandMarkIcon() {\n\treturn (\n\t\t<svg\n\t\t\taria-hidden=\"true\"\n\t\t\tfill=\"none\"\n\t\t\tviewBox=\"0 0 89 76\"\n\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t>\n\t\t\t<path d=\"M5.933 76H0V63.62h5.933V76Z\" fill=\"currentColor\" />\n\t\t\t<path\n\t\t\t\tclipRule=\"evenodd\"\n\t\t\t\td=\"M65.267 6.534H71.2v6.19h5.933v6.19h5.934v6.362h5.768V56.57h-5.768v7.05h-5.934V44.362H71.2v18.914h-5.933V76h-5.934V44.362H53.4v18.914h-5.933V76h-5.934V63.276H35.6V44.362h-5.933V76h-5.934V63.276H17.8V44.362h-5.933V63.62H5.933v-7.05H.165V25.276h5.768v-6.362h5.934v-6.19H17.8v-6.19h5.933V0h41.534v6.534ZM17.8 25.448h5.933v-6.534H17.8v6.534Zm47.467 0H71.2v-6.534h-5.933v6.534Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t\tfillRule=\"evenodd\"\n\t\t\t/>\n\t\t\t<path d=\"M89 76h-5.933V63.62H89V76Z\" fill=\"currentColor\" />\n\t\t</svg>\n\t);\n}\n\nexport function BrandContextMenu({\n\tchildren,\n\tmarkAsset = BRAND_MARK_ASSET,\n\tlogotypeAsset = BRAND_LOGOTYPE_ASSET,\n\tbrandAssetsZipPath = \"https://cdn.tentui.com/brand/tentui-brand-assets.zip\",\n}: BrandContextMenuProps) {\n\treturn (\n\t\t<ContextMenu>\n\t\t\t<ContextMenuTrigger render={children} />\n\t\t\t<ContextMenuContent className=\"w-60 rounded-xl p-1.5\">\n\t\t\t\t<ContextMenuGroup>\n\t\t\t\t\t<CopyAssetItem\n\t\t\t\t\t\tasset={markAsset}\n\t\t\t\t\t\tlabel=\"Copy Mark as SVG\"\n\t\t\t\t\t\ticon={<BrandMarkIcon />}\n\t\t\t\t\t/>\n\t\t\t\t\t<CopyAssetItem\n\t\t\t\t\t\tasset={logotypeAsset}\n\t\t\t\t\t\tlabel=\"Copy Logotype as SVG\"\n\t\t\t\t\t\ticon={<TypeIcon />}\n\t\t\t\t\t/>\n\t\t\t\t</ContextMenuGroup>\n\t\t\t\t<ContextMenuSeparator />\n\t\t\t\t<ContextMenuGroup>\n\t\t\t\t\t<ContextMenuItem\n\t\t\t\t\t\trender={\n\t\t\t\t\t\t\t<a download href={brandAssetsZipPath}>\n\t\t\t\t\t\t\t\t<DownloadIcon />\n\t\t\t\t\t\t\t\tDownload Brand Assets\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclassName=\"h-9 rounded-lg px-2.5\"\n\t\t\t\t\t/>\n\t\t\t\t</ContextMenuGroup>\n\t\t\t</ContextMenuContent>\n\t\t</ContextMenu>\n\t);\n}\n\nexport default BrandContextMenu;\n",
      "type": "registry:component",
      "target": "@components/brand-context-menu.tsx"
    }
  ],
  "meta": {
    "createdAt": "2026-07-21",
    "image": "https://cdn.tentui.com/images/components/brand-context-menu",
    "video": "https://cdn.tentui.com/videos/components/brand-context-menu"
  },
  "docs": "https://tentui.com/components/brand-context-menu",
  "categories": [
    "menus"
  ],
  "type": "registry:component"
}