Lightweight Toggle Switches For Vue.js 3

Description:

A lightweight customizable toggle switch with on/off labels for Vue.js 2 & Vue.js 3 apps.

How to use it:

1. Import and register the component.

<style src="@vueform/toggle/themes/default.css"></style>
import Toggle from '@vueform/toggle'
export default {
  components: {
    Toggle,
  }
}

2. Add the toggle switch component to the app template.

<Toggle v-model="value" />

3. Config the toggle switch with the following props.

id: {
  type: [String, Number],
  required: false,
  default: 'toggle'
},
name: {
  type: [String, Number],
  required: false,
  default: 'toggle'
},
disabled: {
  type: Boolean,
  required: false,
  default: false,
},
required: {
  type: Boolean,
  required: false,
  default: false,
},
falseValue: {
  type: [String, Number, Boolean],
  required: false,
  default: false,
},
trueValue: {
  type: [String, Number, Boolean],
  required: false,
  default: true,
},
onLabel: {
  type: [String, Object],
  required: false,
  default: ''
},
offLabel: {
  type: [String, Object],
  required: false,
  default: ''
},
classes: {
  type: Object,
  required: false,
  default: () => ({})
},
labelledby: {
  type: String,
  required: false,
},
describedby: {
  type: String,
  required: false,
},

Preview:

Lightweight Toggle Switches For Vue.js 3

Changelog:

v2.0.0 (06/03/2020)

  • Removed width, height, speed, colors, fontSize properties and off, on slots.
  • Completely updated default style and classnames.

v1.1.0 (01/06/2020)

  • restructured colors property

Download Details:

Author: vueform

Live Demo: https://jsfiddle.net/p60t2bs4/2/

Download Link: https://github.com/vueform/toggle/archive/main.zip

Official Website: https://github.com/vueform/toggle

Install & Download:

# Yarn
$ yarn add @vueform/toggle

# NPM
$ npm i @vueform/toggle

You Might Be Interested In:

Tags:

Add Comment