Switch

Simple and functional.

State

To implement a switch element in the application, we add the component vs-switch.

Color

You can choose the default Switch. You are able to use the Main Colorsopen in new window or RGB and HEX colors.

WARNING

Supported colors are RGB and HEX

Text

You can add a descriptive text with the slot on or off. You can also join the text with the icons.

Icons

We can add a representative icon inside our switch with the property vs-icon.

If you only need to add the icon in one of the states you can do it with the property vs-icon-on or vs-icon-off

TIP

Vuesax uses the Google Material Icons font library by default. For a list of all available icons, visit the official Material Icons pageopen in new window. Other icon libraries can be used by providing the class for the respective pack in the icon-pack property. ex. FA4 uses fa or fas, FA5 uses fas, far, or fal.

Array Value

For saving the values in an array, you could simply pass it as a value.

WARNING

For using an array as a value, we need to use the vs-value property inside the switch component. That is the value that will be added to the array.

  • [ "luis" ]

API #

NameTypeParametersDescriptiondefault
v-modelboolean || Arraytrue || false || []Link values.
vs-valueStringValue if different from a boolean.
colorStringDefault Colors | HEX | RGBType of element or color.primary
vs-iconStringMaterial IconsIcon within the element.
vs-icon-onStringMaterial IconsIcon that appears when the item is in active state.
vs-icon-offStringMaterial IconsIcon that appears in the inactive state.
icon-packStringIcon Pack Class NameIcon Pack to be used. If not set, icon will default to Material Icons. ex. FA4 uses fa or fas, FA5 uses fas, far, or fal.material-icons