Switch

A toggle control for switching between on and off states.

<script lang="ts">
  import { Switch } from "$lib/components/ui/switch";
  import { Label } from "$lib/components/ui/label";
</script>
 
<div class="flex items-center gap-3">
  <Switch id="airplane" />
  <Label for="airplane">Airplane mode</Label>
</div>

Installation

npx lily-svelte@latest add switch

Usage

<script lang="ts">
	import { Switch } from '$lib/components/ui/switch';
 
	let enabled = $state(false);
</script>
 
<Switch bind:checked={enabled} />

Built by levish. The source code is available on GitHub.

Quiet by design.