Skip to content

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 ​

KeyDefaultDescription
color'success'Vuetify color for the active (on) state
trueValue1Value stored when the switch is on
falseValue0Value stored when the switch is off
hideDetailstrueHide the validation detail row below the switch
default1Initial value (on by default)

Switch vs Checkbox: Both store a boolean-like value. Use switch for prominent on/off settings; use checkbox for compact lists of flags.

See Also ​