A toggle button for simple state management.
npm install --save-dev vue-toggle
or include build/bundle.js
.
# in your component
components:
"toggle": require("vue-toggle")
# or, when using bundle.js
components:
"toggle": window.vueComps.toggle
<toggle>
click to switch
<span slot="on"> off</span>
<span slot="off"> on</span>
</toggle>
For examples see dev/
.
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 |
| 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 |
Clone repository.
npm install
npm run dev
Browse to http://localhost:8080/
.
Copyright (c) 2016 Paul Pflugradt Licensed under the MIT license.