Tiny Themeable On/Off Toggle Component For Vue

Description:

A tiny, easy, and themeable (Material, iOS, Custom) on/off toggle switch component for Vue.js app.

How to use it:

1. Import and register the on/off toggle component.

import OnoffToggle from 'vue-onoff-toggle';
new Vue({
  components: {
    OnoffToggle
  }
})

2. Add the on/off toggle component to the app.

// default theme
<onoff-toggle v-model="checked" />

// iOS theme
<onoff-toggle v-model="checked" theme="ios" />

// Material Theme
<onoff-toggle v-model="checked" theme="material" />
new Vue({
  components: {
    OnoffToggle
  },
  data() {
    return {
      checked: false
    }
  }
})

3. Available component props with default values.

value: { type: Boolean, default: false },
theme: { type: String, default: THEME_DEFAULT },
name: { type: String },
disabled: { type: Boolean, default: false },
onColor: { type: String },
offColor: { type: String },
thumbColor: { type: String },
borderColor: { type: String },
width: { type: [Number, String] },
height: { type: [Number, String] },
margin: { type: [Number, String] },
shadow: { type: Boolean, default: true }

Preview:

tiny-themeable-on-off-toggle-component-for-vue

Changelog:

v1.1.0 (12/10/2020)

  • Use vue-sfc-rollup for better imports and SSR support.

Download Details:

Author: devwiz1028

Live Demo: https://github.com/devwiz1028/vue-onoff-toggle

Download Link: https://github.com/devwiz1028/vue-onoff-toggle/archive/master.zip

Official Website: https://github.com/devwiz1028/vue-onoff-toggle

Install & Download:

# Yarn
$ yarn add vue-onoff-toggle --save

# NPM
$ npm i vue-onoff-toggle --save--save

You Might Be Interested In:

Tags:

Add Comment