{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "switch",
  "type": "registry:ui",
  "title": "Switch",
  "description": "A switch component",
  "dependencies": [
    "solid-js",
    "@kobalte/core"
  ],
  "files": [
    {
      "path": "src/registry/ui/switch.tsx",
      "content": "import type { JSX, ValidComponent } from \"solid-js\"\nimport { splitProps } from \"solid-js\"\n\nimport type { PolymorphicProps } from \"@kobalte/core\"\nimport * as SwitchPrimitive from \"@kobalte/core/switch\"\n\nimport { cn } from \"~/lib/utils\"\n\nconst Switch = SwitchPrimitive.Root\nconst SwitchDescription = SwitchPrimitive.Description\nconst SwitchErrorMessage = SwitchPrimitive.ErrorMessage\n\ntype SwitchControlProps = SwitchPrimitive.SwitchControlProps & {\n  class?: string | undefined\n  children?: JSX.Element\n}\n\nconst SwitchControl = <T extends ValidComponent = \"input\">(\n  props: PolymorphicProps<T, SwitchControlProps>\n) => {\n  const [local, others] = splitProps(props as SwitchControlProps, [\"class\", \"children\"])\n  return (\n    <>\n      <SwitchPrimitive.Input\n        class={cn(\n          \"[&:focus-visible+div]:outline-none [&:focus-visible+div]:ring-2 [&:focus-visible+div]:ring-ring [&:focus-visible+div]:ring-offset-2 [&:focus-visible+div]:ring-offset-background\",\n          local.class\n        )}\n      />\n      <SwitchPrimitive.Control\n        class={cn(\n          \"inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent bg-input transition-[color,background-color,box-shadow] data-[disabled]:cursor-not-allowed data-[checked]:bg-primary data-[disabled]:opacity-50\",\n          local.class\n        )}\n        {...others}\n      >\n        {local.children}\n      </SwitchPrimitive.Control>\n    </>\n  )\n}\n\ntype SwitchThumbProps = SwitchPrimitive.SwitchThumbProps & { class?: string | undefined }\n\nconst SwitchThumb = <T extends ValidComponent = \"div\">(\n  props: PolymorphicProps<T, SwitchThumbProps>\n) => {\n  const [local, others] = splitProps(props as SwitchThumbProps, [\"class\"])\n  return (\n    <SwitchPrimitive.Thumb\n      class={cn(\n        \"pointer-events-none block size-5 translate-x-0 rounded-full bg-background shadow-lg ring-0 transition-transform data-[checked]:translate-x-5\",\n        local.class\n      )}\n      {...others}\n    />\n  )\n}\n\ntype SwitchLabelProps = SwitchPrimitive.SwitchLabelProps & { class?: string | undefined }\n\nconst SwitchLabel = <T extends ValidComponent = \"label\">(\n  props: PolymorphicProps<T, SwitchLabelProps>\n) => {\n  const [local, others] = splitProps(props as SwitchLabelProps, [\"class\"])\n  return (\n    <SwitchPrimitive.Label\n      class={cn(\n        \"text-sm font-medium leading-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-70\",\n        local.class\n      )}\n      {...others}\n    />\n  )\n}\n\nexport { Switch, SwitchControl, SwitchThumb, SwitchLabel, SwitchDescription, SwitchErrorMessage }\n",
      "type": "registry:ui"
    }
  ]
}