Slide Toggles

Svelte Component

A sliding toggle element that can capture input from a user.

Examples

Getting Started

This component provides an alternative UI for a checkbox input element.

typescript
let valueChecked: boolean = false;
html
<SlideToggle name="slider-example" bind:checked={valueChecked}>(text)</SlideToggle>

Additional Sizes

Slide toggles have a default base size, but you can optionally use a smaller or larger size.

html
<SlideToggle ... size="sm" />
<SlideToggle ... size="lg" />

Checkbox Attributes

This component supports Svelte's $$restProps, which allows for required, disabled, and any other valid checkbox input attributes.

html
<SlideToggle ... required disabled />