Components
BaseSwitch
An on/off switch with a text and an optional description, for settings that apply at once.
components/ui/inputs/BaseSwitch.vue
View in the demo
Example
API
It also accepts every prop, slot and event of v-switch, which it passes through.
Props
Name | Type | Default | Description |
|---|---|---|---|
text | string | — | The text next to the switch. |
description | string | — | A second line that explains the setting. |
label | string | — | The visible label above the field, linked to it with for and aria-labelledby. |
input-id | string | — | A fixed id for the input. One is generated with useId() when you leave it out. |
optional | boolean | — | Adds “(optional)” after the label. Never mark required fields. |
info | BaseInputInfo | — | A help popover next to the label: a text or a list of { title, text }. |
v-model | boolean | false | Whether it is on. |
Events
Name | Payload | Description |
|---|---|---|
@update:modelValue | [value: boolean] | — |
Accessibility
Use a switch for settings that take effect immediately and a checkbox for choices confirmed with a submit button.