A personal media tracker built on the AT Protocol
opnshelf.xyz
1import * as SwitchPrimitives from "@radix-ui/react-switch";
2import type * as React from "react";
3
4import { cn } from "@/lib/utils";
5
6function Switch({
7 className,
8 ...props
9}: React.ComponentProps<typeof SwitchPrimitives.Root>) {
10 return (
11 <SwitchPrimitives.Root
12 data-slot="switch"
13 className={cn(
14 "peer data-[state=checked]:bg-(--md-sys-color-primary) data-[state=unchecked]:bg-(--md-sys-color-surface-container-highest) focus-visible:ring-(--md-sys-color-primary)/50 inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-offset-(--md-sys-color-surface) disabled:cursor-not-allowed disabled:opacity-50",
15 className,
16 )}
17 {...props}
18 >
19 <SwitchPrimitives.Thumb
20 data-slot="switch-thumb"
21 className={cn(
22 "bg-(--md-sys-color-on-primary) pointer-events-none block h-5 w-5 rounded-full shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0",
23 )}
24 />
25 </SwitchPrimitives.Root>
26 );
27}
28
29export { Switch };