Forms
Switch
An on/off setting that takes effect at once: a native checkbox with role=switch, so Space toggles it and it posts with a form.
import { EcoSwitch } from "vue-ecosphere"
States
Use a switch when flipping it applies the change; use a checkbox when the choice waits for Save. The label names what is on; no On/Off word beside it.
With a hint
Sizes
The small switch fits dense rows and table cells.
Saving
Set loading while the change saves: the switch shows the new state, marks itself busy and ignores input until the save settles.
EcoSwitch
| Name | Type | Default | Description |
|---|---|---|---|
v-model | boolean | false | On state. |
label | string | — | The thing that is true while it is on, beside the track. Default slot overrides. |
hint | string | — | Second line (switch__h), wired with aria-describedby. #hint slot. |
disabled | boolean | false | Say why in the hint. |
loading | boolean | false | A save in flight: aria-busy, an indicator in the thumb, and input is ignored. |
size | "md" | "sm" | "md" | sm for dense rows and table cells. |
name | string | — | Native name; the form posts on (or the value attribute) while it is on. |
id | string | — | Input id; generated when omitted. |
…attrs | — | — | aria-label (for a switch with no visible label), value and listeners go to the <input>; class/style to the label. |