Switch ​
The switch input type renders a toggle switch using Vuetify's v-switch. It is functionally similar to Checkbox but uses a toggle UI instead of a checkbox. The switch is on by default (default: 1).
Hydrate ​
Class: SwitchHydrateConfig type: switchOutput type: input-switch → VInputSwitch
The hydrate sets hideDetails to true and default to 1 (on) unless you override them.
Usage ​
Basic switch ​
php
[
'type' => 'switch',
'name' => 'is_active',
'label' => 'Active',
]Default off ​
php
[
'type' => 'switch',
'name' => 'is_featured',
'label' => 'Featured',
'default' => 0,
]Custom true/false values ​
php
[
'type' => 'switch',
'name' => 'status',
'label' => 'Status',
'trueValue' => 'enabled',
'falseValue' => 'disabled',
]Schema Defaults ​
| Key | Default | Description |
|---|---|---|
color | 'success' | Vuetify color for the active (on) state |
trueValue | 1 | Value stored when the switch is on |
falseValue | 0 | Value stored when the switch is off |
hideDetails | true | Hide the validation detail row below the switch |
default | 1 | Initial value (on by default) |
Switch vs Checkbox: Both store a boolean-like value. Use
switchfor prominent on/off settings; usecheckboxfor compact lists of flags.
See Also ​
- Checkbox — Same semantics, checkbox UI
- Hydrates reference — Resolution table and schema contract