Skip to content

Switch ​

Overview ​

A toggle switch built on Reka UI's SwitchRoot, with a sliding thumb indicator.

Theme entry: Switch

Props ​

NameTypeRequiredDefaultDescription
themeOverrideObjectnullA partial ThemeObject keyed by component name, merged over this component's theme and provided to descendants.
classstring|array|objectundefinedAdditional CSS classes to apply to the switch root.
defaultValuebooleanundefinedThe default checked state when uncontrolled.
modelValuebooleanundefinedThe controlled checked state (used with v-model).
disabledbooleanundefinedWhether the switch is disabled.
idstringundefinedThe id applied to the underlying input element.
valuestringundefinedThe value submitted with a form when checked.
trueValueboolean|stringundefinedThe value representing the checked state.
falseValueboolean|stringundefinedThe value representing the unchecked state.
asstring|objectundefinedThe element or component to render as.
asChildbooleanfalseWhen true, merges props onto the child element instead of rendering a wrapper.
namestringundefinedThe name submitted with a form.
requiredbooleanundefinedWhether the field is required.

Slots ​

thumb ​

Scoped slot.

Events ​

NameDescription
update:modelValueEmitted when the value changes.

Full event reference

Source ​

client/lib/controls/switch/Switch.vue