Skip to content
On this page

Switch

Basic

Use ASwitch component to create toggle for boolean value.

Colors

You can use color prop to change the switch color.

Label

You can use label prop to add label to switch component.

Label and switch have justify-between added as this is how generally used but you can use flex classes to modify it according to your use.


TIP

You can also use default slot to render the label.

Icons

Use on-icon & off-icon prop to render icons inside switch dot.

Array

Just like ACheckbox, ASwitch also supports array.

Enabled Notifications: []

Custom model values

You can use on-value and off-value props to set custom v-model value.

Status: "enabled"

Sizing

You can use font-size utility to adjust the size of switch.

States

You can use disabled prop to disable the switch.

Roundness

You can adjust switch roundness using border-radius utilities.

API

Switch

modelValue : CheckboxModelValue

Bind v-model value

color : ColorProp

Switch color

disabled : boolean

Disable switch

indeterminateValue : CheckboxModelValue

Set custom value for indeterminate state

cycleIndeterminate : boolean

Enable cycling indeterminate state

offValue : CheckboxModelValue
inputClasses : any

Bind classes to input element

label : string

Define label text

offIcon : string

Icon to render when switch is off

default : any

Default slot for rendering switch label. If default slot is used label prop will be discarded.

update:modelValue => [value: CheckboxModelValue | undefined]

Released under the MIT License.