Files
2026-03-21 13:20:00 -07:00

21 lines
1.7 KiB
JSON

{
"$schema": "https://shadcn-svelte.com/schema/registry-item.json",
"name": "switch",
"type": "registry:ui",
"devDependencies": [
"bits-ui@^2.14.4",
"@internationalized/date@^3.10.0"
],
"files": [
{
"content": "import Root from \"./switch.svelte\";\n\nexport {\n\tRoot,\n\t//\n\tRoot as Switch,\n};\n",
"type": "registry:file",
"target": "switch/index.ts"
},
{
"content": "<script lang=\"ts\">\n\timport { Switch as SwitchPrimitive } from \"bits-ui\";\n\timport { cn, type WithoutChildrenOrChild } from \"$UTILS$.js\";\n\n\tlet {\n\t\tref = $bindable(null),\n\t\tclass: className,\n\t\tchecked = $bindable(false),\n\t\t...restProps\n\t}: WithoutChildrenOrChild<SwitchPrimitive.RootProps> = $props();\n</script>\n\n<SwitchPrimitive.Root\n\tbind:ref\n\tbind:checked\n\tdata-slot=\"switch\"\n\tclass={cn(\n\t\t\"data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 peer inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50\",\n\t\tclassName\n\t)}\n\t{...restProps}\n>\n\t<SwitchPrimitive.Thumb\n\t\tdata-slot=\"switch-thumb\"\n\t\tclass={cn(\n\t\t\t\"bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0 rtl:data-[state=checked]:translate-x-[calc(-100%)]\"\n\t\t)}\n\t/>\n</SwitchPrimitive.Root>\n",
"type": "registry:file",
"target": "switch/switch.svelte"
}
]
}