Toggles a boolean setting between enabled and disabled states.
A controlled ToggleSwitch manages the checked state with v-model for two-way value binding.
The handle slot is available to display custom content.
ToggleSwitch supports customization through the pt property. The appearance, including colors and other visual properties, can be modified by applying custom classes.
When disabled is present, the element cannot be edited and focused.
The invalid state is applied using the invalid property to indicate failed validation, which can be integrated with form validation.
ToggleSwitch integrates seamlessly with the PrimeVue Forms library.
ToggleSwitch component uses a hidden native checkbox element with switch role internally that is only visible to screen readers. Value to describe the component can either be provided via label tag combined with inputId prop or using aria-labelledby, aria-label props.
| Key | Function |
|---|---|
| tab | Moves focus to the switch. |
| space | Toggles the checked state. |