A toggle button for simple state management
npm install vue-toggleA toggle button for simple state management.
``sh`
npm install --save-dev vue-togglebuild/bundle.js
or include .
coffee
in your component
components:
"toggle": require("vue-toggle")
or, when using bundle.js
components:
"toggle": window.vueComps.toggle
`
`html
click to switch
off
on
`
For examples see dev/.#### Props
| Name | type | default | description |
| ---:| --- | ---| --- |
| is-on | Boolean | false | (two-way) toggle state |
| on-class | String | "on" | class of button when on |
| off-class | String | "off" | class of button when off |
| disabled | Boolean | false | is disabled |
#### Events
| Name | description |
| ---:| --- | ---| --- |
| off | will be emitted on click when state was on |
| on | will be emitted on click when state was off |
| toggle | will be emitted on click |
Development
Clone repository.
`sh
npm install
npm run dev
`
Browse to http://localhost:8080/`.