{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "toggle-gooey",
  "type": "registry:component",
  "title": "Gooey Toggle",
  "description": "A pill toggle whose thumb stretches like liquid as it travels, built from two blobs merged by an SVG gooey filter.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "micro",
    "toggle",
    "switch",
    "gooey",
    "liquid",
    "svg filter",
    "settings"
  ],
  "docs": "https://hyperblur.dev/effects/toggle-gooey",
  "files": [
    {
      "path": "registry/hyperblur/toggle-gooey.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/toggle-gooey.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface ToggleGooeyProps\n  extends Omit<React.LabelHTMLAttributes<HTMLLabelElement>, \"onChange\" | \"children\" | \"defaultChecked\"> {\n  checked?: boolean;\n  defaultChecked?: boolean;\n  onCheckedChange?: (checked: boolean) => void;\n  size?: number;\n  label?: string;\n  accent?: string;\n  disabled?: boolean;\n  name?: string;\n}\n\nconst css = `\n.hb-qn2 {\n  position: relative;\n  display: inline-block;\n  box-sizing: border-box;\n  flex: none;\n  width: calc(var(--hb-qn2-h) * 1.75);\n  height: var(--hb-qn2-h);\n  margin: 0;\n  font: inherit;\n  cursor: pointer;\n  -webkit-tap-highlight-color: transparent;\n}\n.hb-qn2 *, .hb-qn2 *::before, .hb-qn2 *::after { box-sizing: border-box; }\n.hb-qn2[data-disabled=\"true\"] { opacity: 0.5; cursor: not-allowed; }\n.hb-qn2-in {\n  position: absolute;\n  inset: 0;\n  z-index: 3;\n  width: 100%;\n  height: 100%;\n  margin: 0;\n  opacity: 0;\n  cursor: inherit;\n}\n.hb-qn2-track {\n  position: absolute;\n  inset: 0;\n  border-radius: 999px;\n  background: #262626;\n  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);\n  transition: background 0.4s ease, box-shadow 0.4s ease;\n}\n.hb-qn2-in:checked ~ .hb-qn2-track {\n  background: var(--hb-qn2-a);\n  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18), 0 0 18px -4px var(--hb-qn2-a);\n}\n.hb-qn2-in:focus-visible ~ .hb-qn2-track { outline: 2px solid var(--hb-qn2-a); outline-offset: 3px; }\n.hb-qn2-goo {\n  position: absolute;\n  inset: 0;\n  z-index: 1;\n  pointer-events: none;\n}\n.hb-qn2-a, .hb-qn2-b {\n  position: absolute;\n  top: calc(var(--hb-qn2-h) * 0.125);\n  left: calc(var(--hb-qn2-h) * 0.125);\n  width: calc(var(--hb-qn2-h) * 0.75);\n  height: calc(var(--hb-qn2-h) * 0.75);\n  border-radius: 50%;\n  background: #fff;\n  transform: translateX(0);\n}\n.hb-qn2-a { transition: transform 0.26s cubic-bezier(0.2, 0.8, 0.3, 1), scale 0.2s ease; }\n.hb-qn2-b { transition: transform 0.5s cubic-bezier(0.5, 0, 0.2, 1), scale 0.2s ease; }\n.hb-qn2-in:checked ~ .hb-qn2-goo .hb-qn2-a,\n.hb-qn2-in:checked ~ .hb-qn2-goo .hb-qn2-b { transform: translateX(calc(var(--hb-qn2-h) * 0.75)); }\n.hb-qn2:active .hb-qn2-a { scale: 1.1 0.92; }\n.hb-qn2:active .hb-qn2-b { scale: 1.18 0.88; }\n.hb-qn2-svg { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }\n@media (prefers-reduced-motion: reduce) {\n  .hb-qn2-track, .hb-qn2-a, .hb-qn2-b { transition: none; }\n  .hb-qn2:active .hb-qn2-a, .hb-qn2:active .hb-qn2-b { scale: 1; }\n}\n`;\n\nexport function ToggleGooey({\n  checked,\n  defaultChecked = false,\n  onCheckedChange,\n  size = 32,\n  label = \"Toggle\",\n  accent = \"#2f7bff\",\n  disabled = false,\n  name,\n  className = \"\",\n  style,\n  ...rest\n}: ToggleGooeyProps) {\n  const filterId = `hb-qn2-${React.useId().replace(/:/g, \"\")}`;\n  const controlled = checked !== undefined;\n  const vars = {\n    \"--hb-qn2-h\": `${size}px`,\n    \"--hb-qn2-a\": accent,\n    ...style,\n  } as React.CSSProperties;\n  const blur = (size * 0.12).toFixed(2);\n\n  return (\n    <>\n      <style href=\"hb-toggle-gooey\" precedence=\"default\">{css}</style>\n      <label className={`hb-qn2 ${className}`} style={vars} data-disabled={disabled} {...rest}>\n        <input\n          type=\"checkbox\"\n          role=\"switch\"\n          className=\"hb-qn2-in\"\n          aria-label={label}\n          name={name}\n          disabled={disabled}\n          {...(controlled ? { checked } : { defaultChecked })}\n          onChange={(e) => onCheckedChange?.(e.target.checked)}\n        />\n        <span className=\"hb-qn2-track\" aria-hidden=\"true\" />\n        <span className=\"hb-qn2-goo\" aria-hidden=\"true\" style={{ filter: `url(#${filterId})` }}>\n          <span className=\"hb-qn2-a\" />\n          <span className=\"hb-qn2-b\" />\n        </span>\n        <svg className=\"hb-qn2-svg\" aria-hidden=\"true\" focusable=\"false\">\n          <filter id={filterId} x=\"-30%\" y=\"-60%\" width=\"160%\" height=\"220%\" colorInterpolationFilters=\"sRGB\">\n            <feGaussianBlur in=\"SourceGraphic\" stdDeviation={blur} result=\"blur\" />\n            <feColorMatrix\n              in=\"blur\"\n              type=\"matrix\"\n              values=\"1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 22 -10\"\n            />\n          </filter>\n        </svg>\n      </label>\n    </>\n  );\n}\n"
    }
  ]
}