Skip to content

Switch

Overview

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

Theme entry: Switch

Props

NameTypeRequiredDefaultDescription
themeOverrideString|Object|ArraynullA partial theme object merged with the component's default theme; accepts a class string, class array, or theme object.
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

Documents matching: server v3.0.0a1.post1client v3.0.0-alpha.2