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

NameTypeDescription
refHTMLInputElementGet the DOM reference of the input element.
labelstringThe label for the toggle switch.
labelAttributesHTMLLabelAttributesAttributes to be spread on the label wrapper element.
labelElementHTMLLabelElementGet the DOM reference of the label element.
disabledbooleanWhether the toggle switch is disabled.
checkedbooleanWhether the toggle switch is checked (on).
Element AttributesobjectAdditional attributes to apply to the toggle switch element.