{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "animated-underline-link",
  "title": "Animated Underline Link",
  "description": "Text links with underlines that move: a line that slides in from the left and out to the right, opens from the centre, draws as a wave, fills behind the text, sweeps like a highlighter, or pushes an arrow, with a faint resting line so they still read as links.",
  "dependencies": [
    "motion",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/animated-underline-link/animated-underline-link.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { motion, 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 UnderlineVariant = \"slide\" | \"center\" | \"fill\" | \"wave\" | \"marker\" | \"arrow\";\n\nexport interface AnimatedUnderlineLinkProps extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, \"color\"> {\n  href: string;\n  children: React.ReactNode;\n  variant?: UnderlineVariant;\n  /** Line / fill colour. Defaults to the text colour. */\n  color?: string;\n  /** Line thickness in px (slide, center, wave). */\n  thickness?: number;\n  /** Adds ↗ and opens in a new tab. */\n  external?: boolean;\n  /** Keep a faint resting underline so it still reads as a link before hover. */\n  resting?: boolean;\n  className?: string;\n}\n\nexport function AnimatedUnderlineLink({ href, children, variant = \"slide\", color = \"currentColor\", thickness = 1.5, external = false, resting = true, className, ...rest }: AnimatedUnderlineLinkProps) {\n  const reduce = Boolean(useReducedMotion());\n  const ease = [0.65, 0, 0.35, 1] as const;\n  const dur = reduce ? 0 : 0.35;\n\n  // center: opens out from the middle and closes back into it.\n  const center = {\n    rest: { scaleX: 0, originX: 0.5, transition: { duration: dur, ease } },\n    hover: { scaleX: 1, originX: 0.5, transition: { duration: dur, ease } },\n  };\n\n  // slide: grows from the left and leaves to the right (the origin flips on the way out).\n  const slide = {\n    rest: { scaleX: 0, originX: 1, transition: { duration: dur, ease } },\n    hover: { scaleX: 1, originX: 0, transition: { duration: dur, ease } },\n  };\n\n  return (\n    <motion.a\n      href={href}\n      target={external ? \"_blank\" : rest.target}\n      rel={external ? \"noopener noreferrer\" : rest.rel}\n      className={cn(\"group relative inline-flex items-baseline no-underline outline-none focus-visible:ring-2 focus-visible:ring-offset-2\", variant === \"fill\" && \"px-[3px]\", className)}\n      style={{ color: \"inherit\", gap: variant === \"arrow\" || external ? 4 : 0, [\"--tw-ring-color\" as string]: \"currentColor\", [\"--tw-ring-offset-color\" as string]: \"transparent\", borderRadius: 3 }}\n      initial=\"rest\"\n      whileHover=\"hover\"\n      whileFocus=\"hover\"\n      animate=\"rest\"\n      {...(rest as object)}\n    >\n      {/* Faint resting line under everything but fill / marker. */}\n      {resting && (variant === \"slide\" || variant === \"center\" || variant === \"arrow\" || variant === \"wave\") && <span aria-hidden=\"true\" className=\"pointer-events-none absolute right-0 bottom-[-2px] left-0\" style={{ height: thickness, background: color, opacity: 0.25 }} />}\n\n      {(variant === \"slide\" || variant === \"arrow\") && <motion.span aria-hidden=\"true\" className=\"pointer-events-none absolute right-0 bottom-[-2px] left-0\" style={{ height: thickness, background: color }} variants={slide} />}\n      {variant === \"center\" && <motion.span aria-hidden=\"true\" className=\"pointer-events-none absolute right-0 bottom-[-2px] left-0\" style={{ height: thickness, background: color }} variants={center} />}\n      {variant === \"fill\" && (\n        <motion.span aria-hidden=\"true\" className=\"pointer-events-none absolute inset-0 -z-0 rounded-[3px]\" style={{ background: color === \"currentColor\" ? \"#F5F4F1\" : color, originY: 1 }} variants={{ rest: { scaleY: 0.08, transition: { duration: dur, ease } }, hover: { scaleY: 1, transition: { duration: dur, ease } } }} />\n      )}\n      {variant === \"marker\" && (\n        <motion.span aria-hidden=\"true\" className=\"pointer-events-none absolute inset-x-[-2px] bottom-[1px] -z-0 rounded-[2px]\" style={{ height: \"42%\", background: color === \"currentColor\" ? \"rgba(255,122,107,0.45)\" : color, originX: 0, originY: 1 }}\n          // With a resting mark it's a thin band that thickens; without one it sweeps in from the left.\n          variants={resting ? { rest: { scaleX: 1, scaleY: 0.22, transition: { duration: dur, ease } }, hover: { scaleX: 1, scaleY: 1, transition: { duration: dur, ease } } } : { rest: { scaleX: 0, transition: { duration: dur, ease } }, hover: { scaleX: 1, transition: { duration: dur, ease } } }}\n        />\n      )}\n      {variant === \"wave\" && (\n        <svg aria-hidden=\"true\" className=\"pointer-events-none absolute right-0 bottom-[-6px] left-0 w-full overflow-visible\" height=\"8\" viewBox=\"0 0 100 8\" preserveAspectRatio=\"none\">\n          <motion.path d=\"M0 4 Q 6.25 0 12.5 4 T 25 4 T 37.5 4 T 50 4 T 62.5 4 T 75 4 T 87.5 4 T 100 4\" fill=\"none\" stroke={color} strokeWidth={thickness} vectorEffect=\"non-scaling-stroke\" strokeLinecap=\"round\" variants={{ rest: { pathLength: 0, transition: { duration: dur } }, hover: { pathLength: 1, transition: { duration: reduce ? 0 : 0.55, ease: \"easeOut\" } } }} />\n        </svg>\n      )}\n\n      <span className={cn(\"relative transition-colors duration-300\", variant === \"fill\" && \"group-hover:text-[#0A0A0A] group-focus-visible:text-[#0A0A0A]\")}>{children}</span>\n      {(variant === \"arrow\" || external) && (\n        <motion.svg aria-hidden=\"true\" className=\"relative shrink-0\" width=\"0.8em\" height=\"0.8em\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2.2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" style={{ alignSelf: \"center\" }} variants={{ rest: { x: 0, y: 0 }, hover: external ? { x: 2, y: -2 } : { x: 3 } }} transition={{ type: \"spring\", stiffness: 500, damping: 24 }}>\n          {external ? <path d=\"M7 17 17 7M8 7h9v9\" /> : <path d=\"M5 12h14M13 6l6 6-6 6\" />}\n        </motion.svg>\n      )}\n      {external && <span className=\"sr-only\"> (opens in a new tab)</span>}\n    </motion.a>\n  );\n}\n\nexport default AnimatedUnderlineLink;\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}