1.0.2 • Published 4 years ago

shapla-switch v1.0.2

Weekly downloads
9
License
MIT
Repository
github
Last release
4 years ago

Shapla Switch

A custom switch for VueJS that exactly work same way as native checkbox

Table of contents

Installation

npm i shapla-switch

Usage

Add the component:

import shaplaSwitch from 'shapla-switch';

export default {
  name: 'Hello',

  components: {
    shaplaSwitch
  },

  data(){
    return {
  	    singleSwitch:false
  	}
  }
}
<shapla-switch v-model="singleSwitch">Enable this</shapla-switch>

Props

PropertyTypeRequiredDefaultDescription
labelStringno | Switch label
valueStringnoonThe default value for the switch
trueValueStringnotrueThe value when user checked the switch
falseValueStringnofalseThe value when user unchecked the switch
disabledBooleannofalseIf set true, box-shadow will be added around button.
readonlyBooleannofalseIf set true, you cannot change the value.

Listeners

The switch component fires the following events:

change: When switch is clicked, it fires the event.

<!-- template -->
<shapla-button @change="handleChange"></shapla-button>


<!-- method -->
methods: {
  handleChange(newValue){
    // Handle change event
  }
}
1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago