页面 · Laravilt
Switch
The Switch primitive for on/off settings.
Import
typescript
Usage
As with the checkbox, the Vue switch binds with plain v-model. The React switch uses checked and onCheckedChange.
vue
tsx
Props
| Vue | React | Description |
|---|---|---|
v-model / modelValue | checked | On/off state |
@update:model-value | onCheckedChange | Change handler |
default-value | defaultChecked | Initial state when uncontrolled |
disabled | disabled | Disabled state |
For a toggle field in a resource form, use the PHP Toggle field. See Form Inputs (PHP).