{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "link-button",
  "title": "Link Button",
  "description": "Inline text action with underline on hover. Renders as a link or button.",
  "registryDependencies": [
    "https://components.exe.xyz/r/utils.json"
  ],
  "files": [
    {
      "path": "src/components/ui/link-button.tsx",
      "content": "import type { ComponentType, MouseEventHandler, ReactNode } from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nexport type IconComponent = ComponentType<{\n  className?: string\n  \"aria-hidden\"?: boolean\n}>\n\nconst sizeClass = {\n  medium: \"h-8 gap-1.5 text-sm [&_svg]:size-4\",\n  small: \"h-7 gap-1 text-[0.8rem] [&_svg]:size-3.5\",\n  xs: \"h-6 gap-1 text-xs [&_svg]:size-3\",\n} as const\n\nexport type LinkButtonProps = {\n  variant?: \"primary\" | \"secondary\"\n  size?: \"medium\" | \"small\" | \"xs\"\n  href?: string\n  leadingIcon?: IconComponent\n  trailingIcon?: IconComponent\n  disabled?: boolean\n  children: ReactNode\n  className?: string\n  type?: \"button\" | \"submit\" | \"reset\"\n  target?: string\n  rel?: string\n  onClick?: MouseEventHandler<HTMLAnchorElement | HTMLButtonElement>\n  id?: string\n  \"aria-label\"?: string\n}\n\nfunction LinkButton({\n  variant = \"primary\",\n  size = \"medium\",\n  href,\n  leadingIcon: LeadingIcon,\n  trailingIcon: TrailingIcon,\n  disabled = false,\n  children,\n  className,\n  type = \"button\",\n  target,\n  rel,\n  onClick,\n  id,\n  \"aria-label\": ariaLabel,\n}: LinkButtonProps) {\n  const classes = cn(\n    \"inline-flex shrink-0 items-center rounded-[2px] font-medium whitespace-nowrap transition-colors outline-none select-none\",\n    \"underline-offset-4 hover:underline focus-visible:underline\",\n    \"focus-visible:ring-3 focus-visible:ring-ring/50\",\n    \"active:translate-y-px\",\n    \"disabled:pointer-events-none disabled:opacity-50\",\n    \"aria-disabled:pointer-events-none aria-disabled:opacity-50\",\n    \"[&_svg]:pointer-events-none [&_svg]:shrink-0\",\n    variant === \"primary\" ? \"text-primary\" : \"text-muted-foreground\",\n    sizeClass[size],\n    className\n  )\n\n  const content = (\n    <>\n      {LeadingIcon ? <LeadingIcon aria-hidden className=\"shrink-0\" /> : null}\n      <span>{children}</span>\n      {TrailingIcon ? <TrailingIcon aria-hidden className=\"shrink-0\" /> : null}\n    </>\n  )\n\n  if (href != null) {\n    const handleClick: MouseEventHandler<HTMLAnchorElement> = (event) => {\n      if (disabled) {\n        event.preventDefault()\n        event.stopPropagation()\n        return\n      }\n      onClick?.(event)\n    }\n\n    return (\n      <a\n        id={id}\n        data-slot=\"link-button\"\n        data-variant={variant}\n        data-size={size}\n        href={href}\n        className={classes}\n        aria-label={ariaLabel}\n        aria-disabled={disabled || undefined}\n        tabIndex={disabled ? -1 : undefined}\n        target={target}\n        rel={rel ?? (target === \"_blank\" ? \"noreferrer noopener\" : undefined)}\n        onClick={handleClick}\n      >\n        {content}\n      </a>\n    )\n  }\n\n  return (\n    <button\n      id={id}\n      data-slot=\"link-button\"\n      data-variant={variant}\n      data-size={size}\n      type={type}\n      disabled={disabled}\n      className={classes}\n      aria-label={ariaLabel}\n      onClick={onClick}\n    >\n      {content}\n    </button>\n  )\n}\n\nexport { LinkButton }\n",
      "type": "registry:ui"
    }
  ],
  "type": "registry:ui"
}