Switch - React
import { Switch } from '@sky-uk/ui-core';
Right-aligned Example
Props
$checked
boolean
value that toggles the Switch on and off.
disabled
The disabled
attribute should be used sparingly when submitting the form.
$loading (deprecated)
boolean
value enables loading state. This has been deprecated in favour of setting the native disabled
attribute, this is more semantic and inclusive however should still be used carefully.
System Modifiers
The Switch
component also supports the props applied using the following system functions:
Translatable Fields
The Switch
component has default state labels "ON/OFF".
These labels could be translated using the the following fields:
switch.statusOn
- label for checked status. Default value isON
switch.statusOff
- label for unchecked status. Default value isOFF
For more on translatable fields, view the useTranslation
docs here: useTranslation