{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "switch",
  "type": "registry:ui",
  "title": "Switch",
  "description": "An on/off toggle that applies immediately. For a choice submitted with a form, prefer Checkbox.",
  "dependencies": [
    "@radix-ui/react-switch@^1.4.1",
    "tailwind-variants@^1.0.0"
  ],
  "registryDependencies": [
    "https://junco.madebytobi.com/r/field.json",
    "https://junco.madebytobi.com/r/junco-theme.json",
    "https://junco.madebytobi.com/r/utils.json"
  ],
  "files": [
    {
      "path": "registry/junco/ui/switch.tsx",
      "type": "registry:ui",
      "content": "import * as React from \"react\";\nimport { tv, type VariantProps } from \"tailwind-variants\";\nimport { cn } from \"@/lib/utils\";\nimport * as SwitchPrimitive from \"@radix-ui/react-switch\";\nimport { useFieldControl } from \"@/components/ui/field\";\n\nexport const switchVariants = tv({\n  slots: {\n    root: [\n      \"peer inline-flex shrink-0 cursor-pointer items-center rounded-pill border border-transparent bg-border-strong p-px\",\n      \"transition-colors duration-base ease-standard\",\n      \"focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring\",\n      \"disabled:cursor-not-allowed disabled:opacity-50\",\n      \"data-[state=checked]:bg-primary\",\n    ],\n    thumb: [\n      \"pointer-events-none block rounded-pill bg-surface shadow-float\",\n      \"transition-transform duration-base ease-spring data-[state=unchecked]:translate-x-0\",\n    ],\n  },\n  variants: {\n    size: {\n      sm: { root: \"h-4 w-7\", thumb: \"size-3.5 data-[state=checked]:translate-x-3\" },\n      md: { root: \"h-5 w-9\", thumb: \"size-[18px] data-[state=checked]:translate-x-4\" },\n      lg: { root: \"h-6 w-11\", thumb: \"size-[22px] data-[state=checked]:translate-x-5\" },\n    },\n  },\n  defaultVariants: { size: \"md\" },\n});\n\nexport interface SwitchProps\n  extends React.ComponentPropsWithoutRef<typeof SwitchPrimitive.Root>,\n    VariantProps<typeof switchVariants> {\n  classNames?: { root?: string; thumb?: string };\n}\n\n/** An on/off toggle that applies immediately. For a choice submitted with a form, prefer Checkbox. */\nexport const Switch = React.forwardRef<React.ElementRef<typeof SwitchPrimitive.Root>, SwitchProps>(\n  ({ className, classNames, size, ...rest }, ref) => {\n    const props = useFieldControl(rest);\n    const styles = switchVariants({ size });\n    return (\n      <SwitchPrimitive.Root ref={ref} className={styles.root({ className: cn(classNames?.root, className) })} {...props}>\n        <SwitchPrimitive.Thumb className={styles.thumb({ className: classNames?.thumb })} />\n      </SwitchPrimitive.Root>\n    );\n  },\n);\nSwitch.displayName = \"Switch\";\n"
    }
  ],
  "docs": "Docs and examples: https://junco.madebytobi.com/docs/components/switch",
  "meta": {
    "hash": "5111022e11fbaf18",
    "source": "packages/react/src/components/switch.tsx",
    "exports": [
      "switchVariants",
      "SwitchProps",
      "Switch"
    ],
    "props": {
      "Switch": {
        "extends": "React.ComponentPropsWithoutRef<typeof SwitchPrimitive.Root>, VariantProps<typeof switchVariants>",
        "props": [
          {
            "name": "classNames",
            "optional": true,
            "type": "{ root?: string; thumb?: string }"
          }
        ]
      }
    },
    "variants": {
      "variants": {
        "size": [
          "sm",
          "md",
          "lg"
        ]
      },
      "defaultVariants": {
        "size": "md"
      }
    },
    "docsUrl": "https://junco.madebytobi.com/docs/components/switch"
  }
}
