Switch
What is this?β
Switch triggers allow merchants to instantly turn on or off the state of a feature or item.
Examplesβ
Standaloneβ
When using a standalone Switch
you should provide an aria-label
property value. As a form
component, it should have a label specified to guarantee accessibility.
With help textβ
Help text
With error textβ
Error text
With help and error textsβ
Help textError text
Disabledβ
Help textError text
Help textError text
Checked Statesβ
There are two checked states: checked
, and not checked
.
Multiple Switchesβ
It is sometimes necessary to render multiple switches and store the checked values in an array. It can be done using our useSwitchState
hook. You just need to pass the hook return object to the switches state
property and define a value
for each Switch
.
TypeError: Cannot read properties of undefined (reading 'join')