{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "toggle",
  "title": "Toggle",
  "description": "A toggle component for switching states.",
  "dependencies": [],
  "registryDependencies": [],
  "files": [
    {
      "path": "src/components/ui/toggle.tsx",
      "content": "\"use client\";\n\nimport type { ElementRef, ComponentPropsWithoutRef } from \"react\";\nimport React, { forwardRef } from \"react\";\nimport * as SwitchPrimitives from \"@radix-ui/react-switch\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"@/stories/lib/utils\";\nimport { Sun, Moon } from \"phosphor-react\";\n\nconst switchVariants = cva(\n  \"focus-visible:ring-ring focus-visible:ring-offset-background peer inline-flex shrink-0 cursor-pointer items-center rounded-full border-4 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50\",\n  {\n    variants: {\n      size: {\n        sm: \"h-5 w-10 \",\n        default: \"h-8 w-16\",\n        lg: \"h-10 w-20\",\n      },\n      variant: {\n        basic:\n          \"data-[state=checked]:bg-primary data-[state=unchecked]:bg-muted dark:data-[state=checked]:bg-secondary-foreground dark:data-[state=unchecked]:bg-muted\",\n        icon: \"bg-muted dark:bg-muted-dark data-[state=checked]:bg-primary data-[state=unchecked]:bg-muted dark:data-[state=checked]:bg-secondary-foreground dark:data-[state=unchecked]:bg-muted\",\n      },\n      theme: {\n        light: \"\",\n        dark: \"dark\",\n      },\n    },\n    defaultVariants: {\n      size: \"default\",\n      variant: \"basic\",\n      theme: \"light\",\n    },\n  },\n);\n\nconst thumbVariants = cva(\n  \" pointer-events-none block rounded-full ring-0 transition-transform\",\n  {\n    variants: {\n      size: {\n        sm: \"h-4 w-4\",\n        default: \"h-7 w-7\",\n        lg: \"h-9 w-9\",\n      },\n      variant: {\n        basic:\n          \"bg-white data-[state=checked]:translate-x-full data-[state=unchecked]:translate-x-0\",\n        icon: \"data-[state=checked]:translate-x-full data-[state=unchecked]:translate-x-0 data-[state=checked]:text-white data-[state=unchecked]:text-black\",\n      },\n    },\n    defaultVariants: {\n      size: \"default\",\n      variant: \"basic\",\n    },\n  },\n);\n\ninterface SwitchProps\n  extends\n    ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>,\n    VariantProps<typeof switchVariants>,\n    VariantProps<typeof thumbVariants> {\n  withIcon?: boolean;\n}\n\nconst Switch = forwardRef<\n  ElementRef<typeof SwitchPrimitives.Root>,\n  SwitchProps\n>(({ className, size, variant, theme, withIcon = false, ...props }, ref) => {\n  return (\n    <SwitchPrimitives.Root\n      className={cn(switchVariants({ size, variant, theme, className }))}\n      {...props}\n      ref={ref}\n    >\n      <SwitchPrimitives.Thumb className={cn(thumbVariants({ size, variant }))}>\n        {withIcon && (\n          <div className=\"flex items-center justify-center h-full w-full \">\n            {/* Show icon depending on state */}\n            {props.checked ? (\n              <Moon weight=\"fill\" className=\"h-5 w-5\" />\n            ) : (\n              <Sun weight=\"fill\" className=\"h-5 w-5\" />\n            )}\n          </div>\n        )}\n      </SwitchPrimitives.Thumb>\n    </SwitchPrimitives.Root>\n  );\n});\n\nSwitch.displayName = SwitchPrimitives.Root.displayName;\n\nexport { Switch };\n",
      "type": "registry:ui",
      "target": "components/ui/toggle.tsx"
    }
  ],
  "type": "registry:ui"
}