switch-13
Directory: switches
Path: /src/lib/components/switches/switch-13.svelte
<script lang="ts">
import Label from '$lib/components/ui/label.svelte';
import Switch from '$lib/components/ui/switch.svelte';
import IconMoon from '@lucide/svelte/icons/moon';
import IconSun from '@lucide/svelte/icons/sun';
const uid = $props.id();
</script>
<div>
<div class="relative inline-grid h-9 grid-cols-[1fr_1fr] items-center text-sm font-medium">
<Switch
id={uid}
checked
class="peer data-[state=unchecked]:bg-input/50 absolute inset-0 h-[inherit] w-auto [&_span]:z-10 [&_span]:h-full [&_span]:w-1/2 [&_span]:transition-transform [&_span]:duration-300 [&_span]:[transition-timing-function:cubic-bezier(0.16,1,0.3,1)] [&_span]:data-[state=checked]:translate-x-full [&_span]:data-[state=checked]:rtl:-translate-x-full"
/>
<span
class="pointer-events-none relative ms-0.5 flex min-w-8 items-center justify-center text-center transition-transform duration-300 [transition-timing-function:cubic-bezier(0.16,1,0.3,1)] peer-data-[state=checked]:invisible peer-data-[state=unchecked]:translate-x-full peer-data-[state=unchecked]:rtl:-translate-x-full"
>
<IconMoon size={16} aria-hidden="true" />
</span>
<span
class="peer-data-[state=checked]:text-background pointer-events-none relative me-0.5 flex min-w-8 items-center justify-center text-center transition-transform duration-300 [transition-timing-function:cubic-bezier(0.16,1,0.3,1)] peer-data-[state=checked]:-translate-x-full peer-data-[state=unchecked]:invisible peer-data-[state=checked]:rtl:translate-x-full"
>
<IconSun size={16} aria-hidden="true" />
</span>
</div>
<Label for={uid} class="sr-only">Labeled switch</Label>
</div>
Discover/Contribute
Explore the original Origin UI or contribute by suggesting new components and improvements.