1.0.1 • Published 8 years ago

vue-toggle v1.0.1

Weekly downloads
23
License
MIT
Repository
github
Last release
8 years ago

vue-toggle

A toggle button for simple state management.

Demo

Install

npm install --save-dev vue-toggle

or include build/bundle.js.

Usage

# 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/.

Props

Nametypedefaultdescription
is-onBooleanfalse(two-way) toggle state
on-classString"on"class of button when on
off-classString"off"class of button when off
disabledBooleanfalseis disabled

Events

Namedescription
offwill be emitted on click when state was on
onwill be emitted on click when state was off
togglewill be emitted on click

Development

Clone repository.

npm install
npm run dev

Browse to http://localhost:8080/.

License

Copyright (c) 2016 Paul Pflugradt Licensed under the MIT license.