Switch

An on/off toggle built on a native checkbox, so keyboard and form behaviour come for free. The knob slides on an ease-out curve.

Examples

Basic

Show code
<Switch label="Notifications" bind:checked={on} />

Disabled

Show code
<Switch label="Notifications" disabled />

Props

PropTypeDefaultDescription
checkedbooleanfalseOn/off state. Bind it with bind:checked.
labelstring—Visible label text beside the switch.

Any other attribute is spread onto the underlying checkbox input.