Skip to content
Direction:
On this page

ToggleSwitch

A checkbox input styled to look like a sliding on/off switch.

Unlike Checkbox, ToggleSwitch is meant to be used alone, not in a group.

Current styles support a single toggle switch with or without a label. The label should only be omitted here if one is added and connected with the input via the for attribute elsewhere (like a future Field component). If you're just using this component by itself, you should include a label.

v-model value will be boolean.

Attributes passed to input

This component will pass any HTML attributes applied to it, except for CSS class, to the <input> element within the component.

Demos

Configurable

NameValue
Props
disabled
Slots
default

Default

Toggle the ToggleSwitch to see the value change. Open up the console to see emitted events.

Toggle switch value: false

With label

Adding content into ToggleSwitch's default slot will generate a <label> element associated with the <input>.

Here are the details

Usage

Props

Prop nameDescriptionTypeDefault
modelValueCurrent value of the toggle switch.

Provided by v-model in a parent component.
booleanfalse
disabledWhether the disabled attribute should be added to the input.booleanfalse

Events

Event namePropertiesDescription
update:modelValuemodelValue boolean - The new model valueEmitted when modelValue changes.

Slots

NameDescriptionBindings
defaultInput label content