1. vue-toggle
A toggle button for simple state management
vue-toggle
Package: vue-toggle
Created by: vue-comps
Last modified: Tue, 28 Jun 2022 20:35:11 GMT
Version: 1.0.1
License: MIT
Downloads: 39
Repository: https://github.com/vue-comps/vue-toggle

Install

npm install vue-toggle
yarn add vue-toggle

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

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.

 npm install
npm run dev

Browse to http://localhost:8080/.

License

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

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code