Skip to content

Switch

SSwitch is a toggle switch built on Reka UI (role="switch", keyboard support, data-state). The label renders through the reused SLabel. It works with v-model (boolean).

Basic usage

Required

required marks the switch as required for form submission (passed through to the control's native semantics).

Color

The color prop sets the color of the on state from the palette.

API

Props

NameTypeDefaultDescription
colorstringundefinedAccent color (of the on state): a name from the palette (primary/teal/teal-10).
text-colorstringundefinedThumb color on the on-state fill: a palette name. White by default.
labelstringundefinedLabel text next to the switch (can be replaced with the default slot).
disabledbooleanundefinedDisables the switch and makes it inactive.
requiredbooleanundefinedRequired for form submission.
idstringundefinedSwitch id. Generated automatically when not set (SSR-safe).
model-valuebooleanfalseSwitch state. Two-way bound via v-model.

Events

NameSignatureDescription
update:modelValue(value: boolean) => voidEmitted when modelValue changes. Used for two-way binding (v-model).

Slots

NameDescription
defaultLabel text (an alternative to the label prop).