{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "link",
  "title": "Link",
  "description": "Styled anchor with emphasis variants and an external-link affordance.",
  "dependencies": [
    "@vllnt/ui@^0.2.1",
    "lucide-react"
  ],
  "registryDependencies": [],
  "files": [
    {
      "path": "registry/default/link/link.tsx",
      "content": "import { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { ExternalLink } from \"lucide-react\";\n\nimport { cn } from \"@vllnt/ui\";\n\nconst linkVariants = cva(\n  \"inline-flex items-center gap-1 rounded-sm underline-offset-4 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\",\n  {\n    defaultVariants: {\n      variant: \"default\",\n    },\n    variants: {\n      variant: {\n        default: \"font-medium text-primary hover:underline\",\n        muted: \"text-muted-foreground hover:text-foreground hover:underline\",\n        underline: \"font-medium text-primary underline hover:text-primary/80\",\n      },\n    },\n  },\n);\n\n/** Props for the {@link Link} component. */\nexport type LinkProps = {\n  /** Render the styles onto the single child element instead of an `<a>`. */\n  asChild?: boolean;\n  /**\n   * Treat the link as external: opens in a new tab, applies safe `rel`, and\n   * appends an external-link icon (unless `showExternalIcon` is `false`).\n   */\n  external?: boolean;\n  /** Show the external-link affordance icon for external links. */\n  showExternalIcon?: boolean;\n} & React.AnchorHTMLAttributes<HTMLAnchorElement> &\n  VariantProps<typeof linkVariants>;\n\n/**\n * Styled anchor with selectable emphasis and an external-link affordance.\n * Composes onto custom routing components via `asChild`.\n * @example\n * <Link href=\"/docs\">Read the docs</Link>\n * <Link href=\"https://example.com\" external>Visit example</Link>\n */\nconst Link = ({\n  asChild = false,\n  children,\n  className,\n  external = false,\n  ref,\n  rel,\n  showExternalIcon = true,\n  target,\n  variant,\n  ...props\n}: LinkProps & { ref?: React.Ref<HTMLAnchorElement> }) => {\n  const Comp = asChild ? Slot : \"a\";\n\n  return (\n    <Comp\n      className={cn(linkVariants({ variant }), className)}\n      ref={ref}\n      rel={external ? (rel ?? \"noreferrer noopener\") : rel}\n      target={external ? (target ?? \"_blank\") : target}\n      {...props}\n    >\n      {asChild ? (\n        children\n      ) : (\n        <>\n          {children}\n          {external && showExternalIcon ? (\n            <ExternalLink aria-hidden=\"true\" className=\"size-3.5 shrink-0\" />\n          ) : null}\n        </>\n      )}\n    </Comp>\n  );\n};\nLink.displayName = \"Link\";\n\nexport { Link, linkVariants };\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component",
  "version": "0.2.1",
  "stability": "stable"
}
