{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "hover-card-code-symbol",
  "title": "Hover Card Code Symbol",
  "description": "An inline code element for a function or type that shows its signature, a one-line description and a reference link in a hover card on hover or focus.",
  "registryDependencies": [
    "hover-card"
  ],
  "files": [
    {
      "path": "registry/patterns/hover-card-code-symbol/hover-card-code-symbol.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\n\nimport {\n  HoverCard,\n  HoverCardContent,\n  HoverCardTrigger,\n} from \"@/components/ui/hover-card\"\n\nexport interface CodeSymbolDoc {\n  /** The signature, e.g. \"useState<T>(initial: T): [T, (v: T) => void]\". */\n  signature: string\n  description: string\n  href?: string\n}\n\nexport interface HoverCardCodeSymbolProps {\n  name: string\n  doc: CodeSymbolDoc\n  openDelay?: number\n}\n\n/**\n * An inline `code` element for a function or type that explains itself on\n * hover or focus: the signature in monospace, a one-line description and a link\n * to the reference. The symbol is a focusable code element and the card is\n * read-only, so documentation prose can mention an API without sending\n * readers away.\n */\nexport function HoverCardCodeSymbol({\n  name,\n  doc,\n  openDelay = 250,\n}: HoverCardCodeSymbolProps) {\n  return (\n    <HoverCard openDelay={openDelay}>\n      <HoverCardTrigger asChild>\n        <code\n          // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex -- focusable so keyboard users can open the signature\n          tabIndex={0}\n          className=\"bg-muted focus-visible:ring-ring cursor-help rounded px-1 py-0.5 font-mono text-[0.85em] outline-none focus-visible:ring-2\"\n        >\n          {name}\n        </code>\n      </HoverCardTrigger>\n      <HoverCardContent className=\"w-80\">\n        <div className=\"grid gap-2\">\n          <pre className=\"bg-muted overflow-x-auto rounded p-2 font-mono text-xs\">\n            {doc.signature}\n          </pre>\n          <p className=\"text-sm\">{doc.description}</p>\n          {doc.href ? (\n            <a\n              href={doc.href}\n              className=\"text-primary text-sm underline-offset-4 hover:underline\"\n            >\n              Read the reference\n            </a>\n          ) : null}\n        </div>\n      </HoverCardContent>\n    </HoverCard>\n  )\n}\n",
      "type": "registry:block"
    }
  ],
  "type": "registry:block"
}