Switch
The Switch component provides a toggle control for binary states like on/off or enabled/disabled.
Import
<script>
import { Switch } from 'svelte-fluentui';
</script>
svelte
Basic Usage
<Switch>Enable notifications</Switch>
svelte
Checked by Default
<Switch checked>Auto-save enabled</Switch>
svelte
Disabled State
<Switch disabled>Feature unavailable</Switch>
svelte
Properties
Property | Type | Default | Description |
---|---|---|---|
checked | boolean | false | Whether the switch is on |
disabled | boolean | false | Whether the switch is disabled |
value | string | undefined | Value when used in a form |
Events
Event | Description |
---|---|
on:change | Fired when the switch state changes |