Appearance
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
| Name | Type | Default | Description |
|---|---|---|---|
color | string | undefined | Accent color (of the on state): a name from the palette
(primary/teal/teal-10). |
text-color | string | undefined | Thumb color on the on-state fill: a palette name. White by default. |
label | string | undefined | Label text next to the switch (can be replaced with the default slot). |
disabled | boolean | undefined | Disables the switch and makes it inactive. |
required | boolean | undefined | Required for form submission. |
id | string | undefined | Switch id. Generated automatically when not set (SSR-safe). |
model-value | boolean | false | Switch state. Two-way bound via v-model. |
Events
| Name | Signature | Description |
|---|---|---|
update:modelValue | (value: boolean) => void | Emitted when modelValue changes. Used for two-way binding (v-model). |
Slots
| Name | Description |
|---|---|
default | Label text (an alternative to the label prop). |