enes

Toggle Switch

A toggle switch represents a physical switch that allows someone to choose between two mutually exclusive options. For example, 'On/Off' and 'Show/Hide'. Choosing an option should produce an immediate result.

Usage

<script>
	import { ToggleSwitch } from 'fluentui-svelte';
</script>

<ToggleSwitch />
<ToggleSwitch label="Toggle me" />
<ToggleSwitch label="I'm disabled" disabled />

States

A toggle switch can be labeled, checked or disabled.

Component Props

NameTypeDefaultDescription
checked bindablebooleanWhether the switch is on.
ref bindableHTMLInputElementThe DOM reference of the input element.
labelstringThe label displayed next to the input element.
labelAttributesHTMLLabelAttributesThe attributes to spread on the label wrapping the switch.
labelElementHTMLLabelElementThe DOM reference of the label element.
SvelteHTMLElements['input']