Switch
An on/off toggle.
MarkdownExamples
Basic
Hint
Like other fields, hint and error show under the label and are read as its description.
A summary every Monday morning.
API
| Prop | Type | Default |
|---|---|---|
disabledDisables the switch. | boolean | false |
labelText next to the switch. The default slot overrides it. | string | — |
sizeSize hook, exposed as | "medium" | "small" | "medium" |
hintHelp text under the switch, announced as its description. | string | — |
error
| string | boolean | — |
nameForm field name: while on, a native form submits | string | — |
valueWhat a native form submits while on, as a checkbox would. | string | "on" |
idId for the switch; generated with | string | — |
modelValueOn or off. | boolean | false |
| Event | Payload |
|---|---|
update:modelValue
| [value: boolean] |
| Slot | Props |
|---|---|
defaultLabel content, replacing | — |
Styling
- Parts
switchswitch-trackswitch-thumbswitch-labelfield-message- States
data-switch-sizedata-switch-checkeddata-switch-errordata-field-namedata-field-tone
Keyboard
| Keys | Action |
|---|---|
Space / Enter | Toggle |