Component
Switch
An immediate on/off control for a setting that applies at once.
import { Switch } from '@loidolt/theme-svelte';
Example
Notes
- Use it for settings that take effect immediately; a checkbox is right for something a submit button confirms.
Props
Generated from the component source, so it cannot drift from the implementation.
| Prop | Type | Default | Notes |
|---|---|---|---|
checked bindable | boolean | false | |
children | Snippet | — | |
class | string | — | |
disabled | boolean | false | |
name | string | — | Set to submit the state with a form; renders a hidden checkbox alongside the switch. |
onCheckedChange | (checked: boolean) => void | — | |
ref bindable | HTMLButtonElement | null | null | |
value | string | 'on' | Submitted value when checked. |
Plus the attributes of HTMLButtonAttributes, forwarded to the root element.