This library is still in development and is available only for internal usage at VTEX.
Skip to main content

Switch

Switch

Version: Next

Switch

Switch triggers allow merchants to instantly turn on or off the state of a feature or item.




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.




Help text


Error text


Help textError text


Help textError text
Help textError text


There are two checked states: checked, and not checked.




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')