{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "switch",
  "title": "Switch",
  "description": "The Material 3 switch, with the icon-in-thumb variants.",
  "dependencies": [
    "@base-ui/react@^1.7.0"
  ],
  "registryDependencies": [
    "https://guillermo-rebolledo.github.io/materialcn/r/materialcn-theme.json",
    "https://guillermo-rebolledo.github.io/materialcn/r/utils.json"
  ],
  "files": [
    {
      "path": "src/components/ui/switch.tsx",
      "content": "\"use client\"\n\nimport { Switch as SwitchPrimitive } from \"@base-ui/react/switch\"\n\nimport { cn } from \"@/lib/utils\"\n\n/**\n * Material 3 switch.\n *\n * Material's switch is much larger than the shadcn default — a 52×32 track with\n * a handle that *grows* from 16dp to 24dp as it travels, and to 28dp while\n * pressed. That size change is the affordance: the handle looks like it is\n * being squashed under a finger. It rides a spatial spring, so it overshoots\n * the far edge slightly before settling.\n *\n * The unselected track carries a 2dp outline; the selected one does not, which\n * is what keeps the \"off\" state from reading as a filled control.\n */\nfunction Switch({\n  className,\n  size = \"default\",\n  ...props\n}: SwitchPrimitive.Root.Props & {\n  size?: \"sm\" | \"default\"\n}) {\n  return (\n    <SwitchPrimitive.Root\n      data-slot=\"switch\"\n      data-size={size}\n      className={cn(\n        \"peer group/switch relative inline-flex shrink-0 cursor-pointer items-center rounded-m3-full outline-none\",\n        \"transition-colors duration-(--m3-spring-effects-default-duration) ease-(--m3-spring-effects-default)\",\n        // Expand the hit target without changing the painted size.\n        \"after:absolute after:-inset-x-2 after:-inset-y-2\",\n        \"focus-visible:outline-m3-secondary focus-visible:outline-3 focus-visible:outline-offset-2\",\n        \"data-[size=default]:h-8 data-[size=default]:w-13\",\n        \"data-[size=sm]:h-6 data-[size=sm]:w-10\",\n        \"data-checked:bg-m3-primary\",\n        \"data-unchecked:bg-m3-surface-container-highest data-unchecked:border-2 data-unchecked:border-m3-outline\",\n        \"data-disabled:cursor-not-allowed\",\n        \"data-disabled:data-checked:bg-m3-on-surface/12\",\n        \"data-disabled:data-unchecked:bg-m3-surface-container-highest/12 data-disabled:data-unchecked:border-m3-on-surface/12\",\n        className,\n      )}\n      {...props}\n    >\n      <SwitchPrimitive.Thumb\n        data-slot=\"switch-thumb\"\n        className={cn(\n          \"pointer-events-none relative block rounded-m3-full\",\n          // Only the travel is spatial; width, height and colour are clamped\n          // properties and ride the effects spring.\n          \"[transition:translate_var(--m3-spring-spatial-fast-duration)_var(--m3-spring-spatial-fast),width_var(--m3-spring-effects-fast-duration)_var(--m3-spring-effects-fast),height_var(--m3-spring-effects-fast-duration)_var(--m3-spring-effects-fast),background-color_var(--m3-spring-effects-fast-duration)_var(--m3-spring-effects-fast)]\",\n          \"motion-reduce:transition-none\",\n          // 40dp state layer centred on the handle (8 / 10 / 10 %).\n          \"before:pointer-events-none before:absolute before:top-1/2 before:left-1/2 before:size-10 before:-translate-1/2 before:rounded-full before:opacity-0\",\n          \"before:transition-opacity before:duration-(--m3-spring-effects-fast-duration) before:ease-(--m3-spring-effects-fast)\",\n          \"data-unchecked:before:bg-m3-on-surface data-checked:before:bg-m3-primary\",\n          \"group-hover/switch:before:opacity-8 group-focus-visible/switch:before:opacity-10 group-active/switch:before:opacity-10\",\n          \"group-data-disabled/switch:before:opacity-0\",\n          // Unselected: a small dot in the outline color, inset from the track.\n          // Interacting darkens it to On Surface Variant.\n          \"data-unchecked:bg-m3-outline\",\n          \"group-hover/switch:data-unchecked:bg-m3-on-surface-variant group-focus-visible/switch:data-unchecked:bg-m3-on-surface-variant group-active/switch:data-unchecked:bg-m3-on-surface-variant\",\n          \"group-data-[size=default]/switch:data-unchecked:size-4 group-data-[size=default]/switch:data-unchecked:translate-x-1.5\",\n          \"group-data-[size=sm]/switch:data-unchecked:size-3 group-data-[size=sm]/switch:data-unchecked:translate-x-1\",\n          // Selected: grows and travels to the far end; interacting tints the\n          // handle to Primary Container.\n          \"data-checked:bg-m3-on-primary\",\n          \"group-hover/switch:data-checked:bg-m3-primary-container group-focus-visible/switch:data-checked:bg-m3-primary-container group-active/switch:data-checked:bg-m3-primary-container\",\n          \"group-data-[size=default]/switch:data-checked:size-6 group-data-[size=default]/switch:data-checked:translate-x-6\",\n          \"group-data-[size=sm]/switch:data-checked:size-5 group-data-[size=sm]/switch:data-checked:translate-x-4.5\",\n          // Pressed: the handle swells under the finger.\n          \"group-active/switch:group-data-[size=default]/switch:size-7\",\n          \"group-active/switch:group-data-[size=default]/switch:data-checked:translate-x-5.5\",\n          \"group-active/switch:group-data-[size=default]/switch:data-unchecked:translate-x-0.5\",\n          \"group-data-disabled/switch:data-checked:bg-m3-surface\",\n          \"group-data-disabled/switch:data-unchecked:bg-m3-on-surface/38\",\n        )}\n      />\n    </SwitchPrimitive.Root>\n  )\n}\n\nexport { Switch }\n",
      "type": "registry:ui"
    }
  ],
  "categories": [
    "forms"
  ],
  "type": "registry:ui"
}