| 1 | "use client"; |
| 2 | |
| 3 | import { Switch as SwitchPrimitive |
| 4 | import { cn } |
| 5 | |
| 6 | function Switch({ |
| 7 | className, |
| 8 | ...props |
| 9 | }: SwitchPrimitive. |
| 10 | return ( |
| 11 | <SwitchPrimitive.Root |
| 12 | data-slot="switch" |
| 13 | className={cn( |
| 14 | "group/switch relative inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors outline-none", |
| 15 | "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background", |
| 16 | "disabled:pointer-events-none disabled:opacity-50", |
| 17 | "bg-input data-[checked]:bg-foreground", |
| 18 | className, |
| 19 | )} |
| 20 | {...props} |
| 21 | > |
| 22 | <SwitchPrimitive.Thumb |
| 23 | data-slot="switch-thumb" |
| 24 | className="pointer-events-none block h-4 w-4 translate-x-0 rounded-full bg-background shadow-sm ring-0 transition-transform group-data-[checked]/switch:translate-x-4" |
| 25 | /> |
| 26 | </SwitchPrimitive.Root> |
| 27 | ); |
| 28 | } |
| 29 | |
| 30 | export { Switch }; |