Component

Switch

Toggle options on or off.

Installation

Usage

Preview

Checked: false

Svelte Code

1
<script lang="ts">
2
  import Switch from '$lib/components/base/switch.svelte';
3
  let checked = $state(false);
4
</script>
5

6
<Switch label="Label here" bind:checked>Helper text here</Switch>
7
<p>Checked: {checked}</p>
8

Edges

Preview

Svelte Code

1
<script lang="ts">
2
  import Switch from '$lib/components/base/switch.svelte';
3
</script>
4

5
<Switch label="Default switch" />
6
<Switch label="Sharp switch" edge="sharp" />
7
<Switch label="Circle switch" edge="circle" />
8

Disabled

Preview

Svelte Code

1
<script lang="ts">
2
  import Switch from '$lib/components/base/switch.svelte';
3
</script>
4

5
<Switch label="Disabled switch" disabled />
6
<Switch label="Disabled switch" disabled checked />
7

Loading

Preview

Svelte Code

1
<script lang="ts">
2
  import Switch from '$lib/components/base/switch.svelte';
3
</script>
4

5
<Switch label="Disabled switch" loading />
6
<Switch label="Disabled switch" loading checked />
7