Switch

Toggle a boolean setting between two states.

Switch

Variants

Use variant to choose a classic moving knob, a soft inset control, or a text state. Icons belong in the existing content slots rather than a separate structural variant. Every style keeps the same native checkbox semantics and borderless focus treatment.

Size

Compare the inherited small, default, and large component sizes.

Default

Generate a switch element easily with beautiful animations and functionality

Color

Change the color of the component when it is in active state, the allowed values ​​are (main colors of Sax Design, RGB, HEX)

Text

Add text with the default slot, or use the on and off slots for state-specific content. The track reserves enough width for the longer state label, so it does not jump when toggled. When a moving knob is present, the current label is centered in the remaining space beside it and stays fully visible.

Icons

Add icons through the default, on, off, or circle slots. The circle slot customizes the classic moving knob directly; no separate icon variant is needed.

Shape

Set shape="square" to use a square track and thumb. Loading and indeterminate states preserve the same square geometry.

Loading

Set loading to outline the thumb with the shared loader, matching shape: a circular orbit for rounded switches and a square orbit for square switches. The thumb stays in place and interaction is blocked while loading. On exit, the outline advances and clears at four boundaries before interaction resumes. The text variant centers its loader over the reserved label area, with the label fading back in during exit.

Indeterminate

Use indeterminate when the bound value matches neither active-value nor inactive-value. The thumb starts in the middle; after selection, the value becomes definite and the thumb resumes its normal left/right movement.

Example

A usual example when using the switch component

API

PROPS

Property
Type
Values
Description
default
Example
More
size
small | medium | large
Set or inherit the switch track and thumb size.
—
—
variant
String
classic | soft | text
Select a structurally distinct borderless switch style.
classic
—
active-text
String
String
Labels used by the text variant.
ON
—
inactive-text
String
String
Labels used by the text variant.
OFF
—
active-value
String | Number | Boolean
custom bound value
Value emitted for the active state.
true
—
inactive-value
String | Number | Boolean
custom bound value
Value emitted for the inactive state.
false
—
shape
String
rounded | square
Select rounded or square geometry for the track and thumb.
rounded
v-model
Boolean | String | Number
Values matched against active-value and inactive-value
Set the current switch value; an unmatched value can be represented as indeterminate.
false
color
String
primary | success | danger | warn | warning | dark | text | light | secondary | RGB | RGBA | HEX | HSL | HSLA
Change the color of the component when it is in active state.
primary
loading
Boolean
truefalse
Show a circular or square loading outline matching shape and disable interaction.
false
indeterminate
Boolean
truefalse
Center the thumb while the bound value matches neither active-value nor inactive-value; the next selection enters a normal definite state.
false
notValue
String
String
Determine the return value of the component when inactive.
—
—

EVENTS

Event
Type
Description
default
Example
More
update:modelValue
Boolean | String | Number
Fire with the configured active or inactive value when the switch changes.
—
—
input
Boolean | String | Number
Fire with the configured active or inactive value when the switch changes.
—
—
change
Boolean | String | Number
Fire with the configured active or inactive value when the switch changes.
—
—

SLOTS

Slot
Scope
Description
default
Example
More
default
null
Add text within the component.
—
on
null
Add text within the component when it is in active state.
—
off
null
Add text within the component when it is in idle state.
—
circle
null
Add an icon to the circle within the component.
—
Last Updated: 2026-10-28, 06:17:56 UTC
Copied