Switch
A Switch is binary and works as a digital on/off button.
Use when two states are opposite and to trigger immediate changes in the system.
Controlled
The selection state can be controlled by using the checked/onChange props.
The value prop represents the underlying submission value of the switch when it is checked.
The switch is Off
Label position
Use the labelPosition prop to change the position of the label.
Custom colors
You can use the color prop to style the color of the switch.
Custom switch
A custom switch can be built by using the underlying form components, such as HvLabel and HvInfoMessage.
See HvFormElement for more information.
Note
For more switch examples, check out our examples page
Related components
Last updated on