{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "switch",
  "title": "Switch",
  "description": "A shadcn-style switch component built with Ark UI primitives.",
  "dependencies": ["@ark-ui/react"],
  "files": [
    {
      "path": "src/components/ui/switch.tsx",
      "content": "\"use client\";\n\nimport { Switch as SwitchPrimitive } from \"@ark-ui/react/switch\";\n\nimport { cn } from \"@/lib/utils\";\n\nexport type SwitchRootProps = SwitchPrimitive.RootProps;\n\nexport const SwitchRoot = ({\n  children,\n  className,\n  ...props\n}: SwitchRootProps) => {\n  return (\n    <SwitchPrimitive.Root\n      data-slot=\"switch\"\n      {...props}\n      className={cn(\"inline-flex items-center gap-2\", className)}\n    >\n      {children}\n      <SwitchPrimitive.HiddenInput />\n    </SwitchPrimitive.Root>\n  );\n};\n\nexport type SwitchControlProps = SwitchPrimitive.ControlProps;\n\nexport const SwitchControl = ({ className, ...props }: SwitchControlProps) => {\n  return (\n    <SwitchPrimitive.Control\n      data-slot=\"switch-control\"\n      className={cn(\n        \"peer relative inline-flex h-6 w-10 shrink-0 cursor-pointer items-center rounded-full border border-transparent bg-input/70 p-0.5 shadow-xs/5 transition-colors outline-none\",\n        \"after:absolute after:-inset-x-3 after:-inset-y-2\",\n        \"data-[state=checked]:bg-primary\",\n        \"focus-visible:ring-3 focus-visible:ring-ring/50\",\n        \"disabled:cursor-not-allowed disabled:opacity-50\",\n        \"data-invalid:ring-3 data-invalid:ring-destructive/20 data-invalid:data-[state=checked]:bg-primary dark:data-invalid:ring-destructive/40\",\n        className,\n      )}\n      {...props}\n    >\n      <SwitchThumb />\n    </SwitchPrimitive.Control>\n  );\n};\n\nexport type SwitchThumbProps = SwitchPrimitive.ThumbProps;\n\nexport const SwitchThumb = ({ className, ...props }: SwitchThumbProps) => (\n  <SwitchPrimitive.Thumb\n    data-slot=\"switch-thumb\"\n    className={cn(\n      \"pointer-events-none block size-5 rounded-full bg-background shadow-sm ring-1 ring-border/30 transition-transform\",\n      \"data-[state=checked]:translate-x-4 rtl:data-[state=checked]:-translate-x-4\",\n      className,\n    )}\n    {...props}\n  />\n);\n\nexport type SwitchProps = SwitchControlProps;\n\nexport const Switch = (props: SwitchProps) => <SwitchControl {...props} />;\n\nexport type SwitchLabelProps = SwitchPrimitive.LabelProps;\n\nexport const SwitchLabel = ({ className, ...props }: SwitchLabelProps) => (\n  <SwitchPrimitive.Label\n    data-slot=\"switch-label\"\n    className={cn(\n      \"text-sm font-medium text-foreground select-none data-disabled:opacity-50 data-invalid:text-destructive\",\n      className,\n    )}\n    {...props}\n  />\n);\n\nexport type SwitchHiddenInputProps = SwitchPrimitive.HiddenInputProps;\n\nexport const SwitchHiddenInput = (props: SwitchHiddenInputProps) => (\n  <SwitchPrimitive.HiddenInput data-slot=\"switch-hidden-input\" {...props} />\n);\n\nexport const SwitchContext = SwitchPrimitive.Context;\nexport const SwitchRootProvider = SwitchPrimitive.RootProvider;\n\nexport type { UseSwitchProps, UseSwitchReturn } from \"@ark-ui/react/switch\";\nexport { useSwitch, useSwitchContext } from \"@ark-ui/react/switch\";\n",
      "type": "registry:ui",
      "target": "src/components/ui/switch.tsx"
    }
  ],
  "type": "registry:ui"
}
