Vue Toggles is a highly customizable and accessible toggle/switch component for Vue 3 (v2.2.2, stable, actively maintained). It provides accessibility support out of the box: aria-checked, aria-readonly, and prefers-reduced-motion. Props allow control over colors, sizes, text, and orientation. Supports v-model and @click patterns. Ships TypeScript types. Minimal footprint with only Vue 3 as a peer dependency. Differentiators: strong accessibility focus, simple API, no extra dependencies.
npm install vue-togglesVerified import paths — ran on the pinned version, not inferred.
Shows registering the component globally and using v-model in a Vue 3 component with TypeScript.
Check the source or the latest documentation for correct usage.
Use v-model="myVar" instead of @click="myVar = !myVar".
Ensure the v-model variable is explicitly boolean (e.g., ref(false)).
Run 'npm install vue-toggles' and ensure the import statement is 'import { VueToggles } from "vue-toggles"'.Run 'npm install vue-toggles' (types are bundled). Restart TS server.
Register the component: either globally (app.component) or locally ('components: { VueToggles }').Ensure the variable is boolean: 'const myVar = ref(false)' or use ':value="myVar" @click="myVar = !myVar"'.