{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "inline-link-button",
  "title": "Inline Link Button",
  "description": "A text button that looks like a link, for secondary actions: Forgot password?, View all, Undo, Remove, Read the docs. Neutral, muted, accent or danger, an underline that's always on, on hover or off, an arrow that nudges, and a ↗ for external links. Renders a link when you pass href, a button when you don't.",
  "dependencies": [
    "motion",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/inline-link-button/inline-link-button.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { useReducedMotion } from \"motion/react\";\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nfunction cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs));\n}\n\nexport type InlineLinkTone = \"neutral\" | \"muted\" | \"accent\" | \"danger\";\nexport type InlineLinkSize = \"xs\" | \"sm\" | \"md\" | \"lg\";\n\nexport interface InlineLinkButtonProps extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement> & React.ButtonHTMLAttributes<HTMLButtonElement>, \"children\" | \"className\" | \"href\" | \"type\"> {\n  /** Renders a link when set, a button when not. */\n  href?: string;\n  /** For links: open in a new tab and show a ↗. */\n  external?: boolean;\n  /** For buttons. */\n  type?: \"button\" | \"submit\" | \"reset\";\n  tone?: InlineLinkTone;\n  size?: InlineLinkSize;\n  /** always: underlined at rest. hover: underline appears on hover. none: never. */\n  underline?: \"always\" | \"hover\" | \"none\";\n  /** Icon before the text. */\n  icon?: React.ReactNode;\n  /** A trailing arrow that nudges forward on hover. */\n  arrow?: boolean;\n  /** Accent colour for tone=\"accent\". */\n  accentColor?: string;\n  theme?: \"dark\" | \"light\";\n  className?: string;\n  children: React.ReactNode;\n}\n\nconst PALETTES = {\n  dark: { neutral: \"#F5F4F1\", muted: \"rgba(245,244,241,0.62)\", accent: \"#7CB8FF\", danger: \"#FF7A6B\", focus: \"rgba(245,244,241,0.85)\" },\n  light: { neutral: \"#0A0A0A\", muted: \"rgba(10,10,10,0.6)\", accent: \"#2563EB\", danger: \"#E5484D\", focus: \"rgba(10,10,10,0.85)\" },\n};\n\nconst SIZES: Record<InlineLinkSize, { font: number; icon: number; gap: number }> = {\n  xs: { font: 12, icon: 12, gap: 4 },\n  sm: { font: 13, icon: 13, gap: 5 },\n  md: { font: 14.5, icon: 15, gap: 6 },\n  lg: { font: 16, icon: 16, gap: 7 },\n};\n\nexport function InlineLinkButton({ href, external = false, type = \"button\", tone = \"neutral\", size = \"md\", underline = \"hover\", icon, arrow = false, accentColor, theme = \"dark\", className, children, ...rest }: InlineLinkButtonProps) {\n  const p = PALETTES[theme];\n  const s = SIZES[size];\n  const reduce = Boolean(useReducedMotion());\n  const color = tone === \"accent\" ? (accentColor ?? p.accent) : p[tone];\n  const isLink = typeof href === \"string\";\n\n  const classes = cn(\n    \"group/ilb inline-flex cursor-pointer items-center rounded-[4px] align-baseline font-medium outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-45\",\n    \"text-[var(--ilb-color)] decoration-[var(--ilb-deco)] underline-offset-[3px] transition-[color,text-decoration-color,opacity] duration-150\",\n    underline === \"always\" && \"underline hover:decoration-[var(--ilb-color)]\",\n    underline === \"hover\" && \"hover:underline focus-visible:underline\",\n    tone === \"muted\" && \"hover:text-[var(--ilb-hover)]\",\n    className,\n  );\n  const style = {\n    gap: s.gap,\n    fontSize: s.font,\n    lineHeight: 1.4,\n    // Colour goes through a variable so the muted tone's hover class can override it.\n    [\"--ilb-color\" as string]: color,\n    [\"--ilb-deco\" as string]: `color-mix(in srgb, ${color} 40%, transparent)`,\n    [\"--ilb-hover\" as string]: p.neutral,\n    [\"--tw-ring-color\" as string]: p.focus,\n    [\"--tw-ring-offset-color\" as string]: \"transparent\",\n  } as React.CSSProperties;\n\n  const content = (\n    <>\n      {icon && (\n        <span className=\"flex shrink-0 [&>svg]:h-full [&>svg]:w-full\" style={{ width: s.icon, height: s.icon }}>\n          {icon}\n        </span>\n      )}\n      <span>{children}</span>\n      {arrow && !(isLink && external) && (\n        <svg width={s.icon} height={s.icon} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\" className=\"shrink-0 transition-transform duration-200 ease-out group-hover/ilb:translate-x-[3px]\" style={reduce ? { transition: \"none\" } : undefined}>\n          <path d=\"M5 12h14M13 6l6 6-6 6\" />\n        </svg>\n      )}\n      {isLink && external && (\n        <svg width={s.icon - 1} height={s.icon - 1} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\" className=\"shrink-0 transition-transform duration-200 ease-out group-hover/ilb:translate-x-[2px] group-hover/ilb:-translate-y-[2px]\" style={reduce ? { transition: \"none\" } : undefined}>\n          <path d=\"M7 17 17 7M8 7h9v9\" />\n        </svg>\n      )}\n    </>\n  );\n\n  if (isLink) {\n    return (\n      <a href={href} className={classes} style={style} {...(external ? { target: \"_blank\", rel: \"noopener noreferrer\" } : {})} {...(rest as React.AnchorHTMLAttributes<HTMLAnchorElement>)}>\n        {content}\n        {external && <span className=\"sr-only\"> (opens in a new tab)</span>}\n      </a>\n    );\n  }\n  return (\n    <button type={type} className={classes} style={style} {...(rest as React.ButtonHTMLAttributes<HTMLButtonElement>)}>\n      {content}\n    </button>\n  );\n}\n\nconst undoIcon = (\n  <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n    <path d=\"M9 14 4 9l5-5M4 9h10.5a5.5 5.5 0 0 1 0 11H11\" />\n  </svg>\n);\n\nexport function InlineLinkButtonDemo({ theme = \"dark\" }: { theme?: \"dark\" | \"light\" }) {\n  const [removed, setRemoved] = React.useState(false);\n  const panel = theme === \"dark\" ? { bg: \"#0E0E0E\", border: \"rgba(255,255,255,0.1)\", text: \"rgba(245,244,241,0.75)\", faint: \"rgba(245,244,241,0.45)\" } : { bg: \"#FFFFFF\", border: \"rgba(10,10,10,0.1)\", text: \"rgba(10,10,10,0.72)\", faint: \"rgba(10,10,10,0.45)\" };\n  return (\n    <div className=\"flex w-full max-w-[420px] flex-col\" style={{ gap: 14, fontFamily: \"Inter, sans-serif\" }}>\n      <div className=\"flex flex-col\" style={{ gap: 12, padding: 18, borderRadius: 16, background: panel.bg, border: `1px solid ${panel.border}` }}>\n        <p className=\"text-[14px] leading-relaxed\" style={{ color: panel.text }}>\n          By signing up you agree to our{\" \"}\n          <InlineLinkButton theme={theme} href=\"#terms\" underline=\"always\" size=\"md\">\n            Terms\n          </InlineLinkButton>{\" \"}\n          and{\" \"}\n          <InlineLinkButton theme={theme} href=\"#privacy\" underline=\"always\" size=\"md\">\n            Privacy Policy\n          </InlineLinkButton>\n          .\n        </p>\n        <div className=\"flex items-center justify-between\">\n          <InlineLinkButton theme={theme} tone=\"muted\" size=\"sm\">\n            Forgot password?\n          </InlineLinkButton>\n          <InlineLinkButton theme={theme} tone=\"accent\" size=\"sm\" href=\"#docs\" external>\n            Read the docs\n          </InlineLinkButton>\n        </div>\n      </div>\n      <div className=\"flex items-center justify-between\" style={{ padding: \"12px 16px\", borderRadius: 14, background: panel.bg, border: `1px solid ${panel.border}` }}>\n        <span className=\"text-[13.5px]\" style={{ color: panel.text }}>\n          {removed ? \"Invoice #2041 removed.\" : \"Invoice #2041 is overdue.\"}\n        </span>\n        {removed ? (\n          <InlineLinkButton theme={theme} size=\"sm\" icon={undoIcon} onClick={() => setRemoved(false)}>\n            Undo\n          </InlineLinkButton>\n        ) : (\n          <InlineLinkButton theme={theme} tone=\"danger\" size=\"sm\" onClick={() => setRemoved(true)}>\n            Remove\n          </InlineLinkButton>\n        )}\n      </div>\n      <div className=\"flex items-center justify-between\" style={{ padding: \"0 4px\" }}>\n        <span className=\"text-[13px] font-medium\" style={{ color: panel.faint }}>\n          Recent projects\n        </span>\n        <InlineLinkButton theme={theme} size=\"sm\" arrow href=\"#projects\">\n          View all\n        </InlineLinkButton>\n      </div>\n    </div>\n  );\n}\n\nexport default InlineLinkButton;\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}