Socket
Socket
Sign inDemoInstall

vuejs-toggle-switch

Package Overview
Dependencies
0
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    vuejs-toggle-switch

A toggle switch component for Vue.js 2+


Version published
Maintainers
1
Created

Readme

Source

vuejs-toggle-switch

Toggle switch for vue.js 2+

Live demo only image under

license updated dependecies

Only 1 dependency (vue)

Setup

install:

npm install vuejs-toggle-switch --save

Import: (in your main.js)

import ToggleSwitch from 'vuejs-toggle-switch'
Vue.use(ToggleSwitch)

Usage

Use: (in your local .vue file/component, html section)


      <toggle-switch
        preSelected="Map" // This is optional     
        :labels="{map: 'Map', transit: 'Transit', satellite: 'Satellite'}"
        :width="380" // This is optional
        :height="24" // This is optional
        :padding="2" // This is optional
        @change="updateMap($event.value)" // This is optional
        @selected="selectedMethod() // This is optional
        v-model="selectedMapOption"/> // This is optional

Properties

NameTypeDefaultDescription
widthNumber100Width of labels
heightNumber34Height
paddingNumber7adjust text location in label with this
backgroundColorStringwhitebackground color (not selected)
colorStringblacktext color (not selected)
borderColorString#007affborder color
selectedColorStringwhitetext color selected label
selectedBackgroundColorString#007affselected label background color
fontFamilyStringn/afont of label text
fontSizeNumber14text size
disabledBooleanfalsedisable switch
preSelectedStringunknownset (pre) selected label
labels[String, Object]n/alabels for switch
valueStringn/avalue, ie: v-model="selectedMapOption"

Events

NameDescription
changeTriggered on toggle, user selects switch option, returns current value. @change="vmValueItem = $event.value"
selectedTriggered whenever user select switch item
inputTriggered on mount if preSelected is set or value is set, and on toggle/change

Keywords

FAQs

Last updated on 01 Feb 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc