ToggleSwitch

ToggleSwitch is used to select a boolean value.

PREVIEW

Toggles a boolean setting between enabled and disabled states.

basic-demo

A controlled ToggleSwitch manages the checked state with v-model for two-way value binding.

controlled-demo

The handle slot is available to display custom content.

template-demo

ToggleSwitch supports customization through the pt property. The appearance, including colors and other visual properties, can be modified by applying custom classes.

customization-demo

When disabled is present, the element cannot be edited and focused.

disabled-demo

The invalid state is applied using the invalid property to indicate failed validation, which can be integrated with form validation.

invalid-demo

ToggleSwitch integrates seamlessly with the PrimeVue Forms library.

forms-demo

Screen Reader

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.

Keyboard Support

KeyFunction
tabMoves focus to the switch.
spaceToggles the checked state.
Theme Designer