{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "magnetic-button",
  "type": "registry:component",
  "title": "MagneticButton",
  "description": "A button gently attracted to the cursor while hovered, springing back on leave. GSAP smoothing; respects reduced-motion.",
  "dependencies": [
    "gsap"
  ],
  "registryDependencies": [],
  "tier": "free",
  "note": "Requires the .prism-magnetic style from globals.css.",
  "files": [
    {
      "path": "components/prism/MagneticButton.tsx",
      "content": "\"use client\";\n\nimport { useRef } from \"react\";\nimport gsap from \"gsap\";\n\n/**\n * MagneticButton — an element that's gently attracted to the cursor while hovered,\n * then springs back on leave. GSAP for the smoothing (already a dep). Honors\n * prefers-reduced-motion (no transform applied).\n */\nexport function MagneticButton({\n  children,\n  className = \"\",\n  strength = 0.4,\n  onClick,\n  type = \"button\",\n}: {\n  children: React.ReactNode;\n  className?: string;\n  /** 0–1: how strongly it follows the cursor. */\n  strength?: number;\n  onClick?: () => void;\n  type?: \"button\" | \"submit\";\n}) {\n  const ref = useRef<HTMLButtonElement>(null);\n\n  function onMove(e: React.MouseEvent<HTMLButtonElement>) {\n    const el = ref.current;\n    if (!el) return;\n    if (window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches) return;\n    const r = el.getBoundingClientRect();\n    const x = (e.clientX - (r.left + r.width / 2)) * strength;\n    const y = (e.clientY - (r.top + r.height / 2)) * strength;\n    gsap.to(el, { x, y, duration: 0.6, ease: \"power3.out\" });\n  }\n\n  function onLeave() {\n    const el = ref.current;\n    if (!el) return;\n    gsap.to(el, { x: 0, y: 0, duration: 0.7, ease: \"elastic.out(1, 0.4)\" });\n  }\n\n  return (\n    <button\n      ref={ref}\n      type={type}\n      onClick={onClick}\n      onMouseMove={onMove}\n      onMouseLeave={onLeave}\n      className={`prism-magnetic ${className}`}\n    >\n      {children}\n    </button>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/prism/MagneticButton.tsx"
    }
  ]
}