Skip to content
LoidoltTheme 0.11.1
Svelte 5

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.

Switch props
PropTypeDefaultNotes
checked bindablebooleanfalse
children Snippet—
class string—
disabled booleanfalse
name string—Set to submit the state with a form; renders a hidden checkbox alongside the switch.
onCheckedChange (checked: boolean) => void—
ref bindableHTMLButtonElement | nullnull
value string'on'Submitted value when checked.

Plus the attributes of HTMLButtonAttributes, forwarded to the root element.