Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Vue.js Toggle Button - A dynamic, fully customizable toggle button aka toggle switch

NotificationsYou must be signed in to change notification settings

JonathanDn/vue-toggle-btn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Highly Customizable, easy-to-use elegant toggle/switch button component

MIT Licenseview on npm

Demo

toggle-btn

Usage

Install via NPMnpm i vue-toggle-btn

Then require in your project:

varVueToggleBtn=require('vue-toggle-btn');

or ES6 syntax:

importVueToggleBtnfrom'vue-toggle-btn';

Then you can register the component globally:

Vue.component('vue-toggle-btn',VueToggleBtn);

Or in your Vue component:

components:{ToggleBtn}

You can then use the following selector anywhere in your project:

  • To get up and running quick the package now supports rendering just the selector with default values
<vue-toggle-btn></vue-toggle-btn>

Properties

options is a full configuration object holding the toggle-button building blocks which arehandle,track andisActive

propertyTypeDescription
optionsobjectholds all toggle button style configurations
isActivefalseholds the current boolean state of the button - can befalse ortrue
handleobjectholds all handle style configurations
trackobjectholds all track style configurations

handle

propertyTypeDefaultDescription
diameternumber30Sets the handle diameter (the round button moving)
colorstring#fffSets the handle color
borderRadiusstring50%Sets the handle border radius

track

propertyTypeDefaultDescription
widthnumber70Sets the track width
heightnumber30Sets the track height
colorstring#cccSets the default track color
activeColorstring#2196F3Sets the active status track color(after toggled)
borderWidthnumber0Sets the track border width
borderRadiusstring34pxSets the track border radius

events

Event NameReturnsDescription
setIsActiveisActiveClicking the toggle button emits an its currentisActive boolean state

Listening to the event e.g:

<vue-toggle-btn@isActive="myLocalSetterFunction($event)"></vue-toggle-btn>

Feedback would be much appreciated, questions, suggestions, issues are more than welcome.


👨‍💻 Follow me onTwitter.

Donation

If this project helped you reduce development time, you can buy me a cup of coffee :)

About

Vue.js Toggle Button - A dynamic, fully customizable toggle button aka toggle switch

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp