ToggleSwitch
Toggles a setting on or off, and immediately saves the change
Name | Type | Default | Description |
---|---|---|---|
aria-describedby | string | The id of the DOM node that describes the switch | |
aria-labelledby Required | string | The id of the DOM node that labels the switch | |
defaultChecked | boolean | Uncontrolled - whether the switch is turned on | |
disabled | boolean | Whether the switch is ready for user input | |
loading | boolean | Whether the switch's value is being calculated | |
checked | boolean | Whether the switch is turned on | |
onChange | (on: boolean) => void | The callback that is called when the switch is toggled on or off | |
onClick | (e: MouseEvent) => void | The callback that is called when the switch is clicked | |
size | 'small' | 'medium' | 'medium' | Size of the switch |
statusLabelPosition | 'start' | 'end' | 'start' | <div>Whether the "on" and "off" labels should appear before or after the switch.</div> <div> <Text fontWeight="bold">This should only be changed when the switch's alignment needs to be adjusted.</Text> For example: It needs to be left-aligned because the label appears above it and the caption appears below it. </div> |
loadingLabelDelay | number | 2000 | When the switch is in the loading state, this value controls the amount of delay in milliseconds before the word "Loading" is announced to screen readers. |