All Projects → drewjbartlett → Vue Switches

drewjbartlett / Vue Switches

An on/off switch component for Vue.js with theme support.

Projects that are alternatives of or similar to Vue Switches

Jtsage Datebox
A multi-mode date and time picker for Bootstrap (3&4), jQueryMobile, Foundation, Bulma, FomanticUI, and UIKit (or others)
Stars: ✭ 481 (+155.85%)
Mutual labels:  bootstrap, bulma
Landio Html
Landio design (Sketch to HTML)
Stars: ✭ 809 (+330.32%)
Mutual labels:  demo, bootstrap
Responsiveframework
Easily make Flutter apps responsive. Automatically adapt UI to different screen sizes. Responsiveness made simple. Demo: https://gallery.codelessly.com/flutterwebsites/minimal/
Stars: ✭ 476 (+153.19%)
Mutual labels:  demo, bootstrap
Coreui Vue
Over 90 Bootstrap based Vue.js components and directives. CoreUI React.js UI Components. CoreUI for Vue.js replaces and extends the Bootstrap javascript. Components have been built from scratch as true Vue components, without jQuery and unneeded dependencies.
Stars: ✭ 318 (+69.15%)
Mutual labels:  vue-components, bootstrap
Bootstrap Table
An extended table to integration with some of the most widely used CSS frameworks. (Supports Bootstrap, Semantic UI, Bulma, Material Design, Foundation, Vue.js)
Stars: ✭ 11,068 (+5787.23%)
Mutual labels:  bootstrap, bulma
Ssm booksystem
ssm demo,ssm详细教程,SSM简明教程:简单的十步教你搭建人生第一个SSM框架[ SSM框架整合教程(spring+spring mvc+mybatis+redis+maven+idea+bootstrap) ]
Stars: ✭ 355 (+88.83%)
Mutual labels:  demo, bootstrap
Tableexport
The simple, easy-to-implement library to export HTML tables to xlsx, xls, csv, and txt files.
Stars: ✭ 781 (+315.43%)
Mutual labels:  demo, bootstrap
Koa Vue Notes Web
🤓 This is a simple SPA built using Koa as the backend, Vue as the first frontend, and React as the second frontend. Features MySQL integration, user authentication, CRUD note actions, and Vuex store modules.
Stars: ✭ 200 (+6.38%)
Mutual labels:  demo, bootstrap
Aybolit
Lightweight web components library built with LitElement.
Stars: ✭ 90 (-52.13%)
Mutual labels:  bootstrap, bulma
Hepek
Web content generators in Scala. Intuitive, scalable, powerful.
Stars: ✭ 69 (-63.3%)
Mutual labels:  bootstrap, bulma
Pagy
🏆 The Best Pagination Ruby Gem 🥇
Stars: ✭ 3,340 (+1676.6%)
Mutual labels:  bootstrap, bulma
Genealogy
Laravel 8 and Vue family tree and genealogy data processing website.
Stars: ✭ 153 (-18.62%)
Mutual labels:  demo, bulma
pagination
No description or website provided.
Stars: ✭ 14 (-92.55%)
Mutual labels:  bulma, vue-components
Hackathon Toolkit
GCP Hackathon Toolkit
Stars: ✭ 358 (+90.43%)
Mutual labels:  demo, bootstrap
vue-checkbox-switch
A Vue component for checkbox's switch style
Stars: ✭ 36 (-80.85%)
Mutual labels:  bulma, vue-components
Silex Kitchen Edition
This project is a sample or a bootstrap silex application
Stars: ✭ 645 (+243.09%)
Mutual labels:  demo, bootstrap
Awesome Uikit
Collect JS Frameworks, Web components library and Admin Template.
Stars: ✭ 1,136 (+504.26%)
Mutual labels:  vue-components, bootstrap
Blazorise
Blazorise is a component library built on top of Blazor with support for CSS frameworks like Bootstrap, Bulma, AntDesign, and Material.
Stars: ✭ 2,103 (+1018.62%)
Mutual labels:  bootstrap, bulma
Formr
Create and Validate PHP Forms in Seconds.
Stars: ✭ 163 (-13.3%)
Mutual labels:  bootstrap, bulma
Fluttergames
Flutter app for purchasing and renting games.
Stars: ✭ 182 (-3.19%)
Mutual labels:  demo

Vue Switches

npm npm

A Vue.js component for simple switches with theme support for bulma, bootstrap and custom themes. See a live demo here.

Installation

npm install vue-switches --save

Basic Usage

import Switches from 'vue-switches';

new Vue({

    components: {
        Switches
    },

    data () {
        return {
            enabled: false
        }
    }
};
<switches v-model="enabled"></switches>

Props

Prop Description
label A static label to always display whether on or off.
text-enabled The text that displays when enabled.
text-disabled The text that displays when disabled.
theme Which theme to use.
color Which color to use.
type-bold Bigger style.
emit-on-mount By default, a "changed" event is emitted when the component mounts. To disable this, set this to false.

Theme Support

Out of the box vue-switches supports a default, bulma, bootstrap themes. To use them you can do as follows:

Providing no theme or color props would render a switch of default theme and color.

 <switches v-model="enabled"></switches>

Available colors for default are default, red, blue, green, and yellow, and orange.

<switches v-model="enabled" theme="bulma" color="default"></switches>

Available colors for Bulma are default, primary, red, blue, green, and yellow.

In addition support for bootstrap can be used as follows:

<switches v-model="enabled" theme="bootstrap" color="danger"></switches>

Available colors for bootstrap are default, primary, success, info, warning, and danger.

Styles

Out of the box vue-switches has two styles: default and bold. By default the switch is not bold. To enable the bold style you can set type-bold to true like this:

<switches v-model="enabled" type-bold="true"></switches>

A demo of all themes and styles can be seen here.

Making Your Own Themes

Vue Switcher has a base class of .vue-switcher. For an unchecked switch a class of .vue-switcher--unchecked is applied. Lastly, for the theme and color props a class is also applied. So for a bulma theme of color primary the classes .vue-switcher-theme--bulma and .vue-switcher-color--primary.

This:

<switches v-model="enabled" type-bold="false" theme="custom" color="blue"></switches>

Would render the classes .vue-switcher-theme--custom and .vue-switcher-color--blue. Sass for this theme could look like:

.vue-switcher-theme--custom {
    &.vue-switcher-color--blue {
        div {
            background-color: lighten(blue, 10%);

            &:after {
                // for the circle on the switch
                background-color: darken(blue, 5%);
            }
        }

        &.vue-switcher--unchecked {
            div {
                background-color: lighten(blue, 30%);

                &:after {
                    background-color: lighten(blue, 10%);
                }
            }
        }
    }
}

For better understanding, below is how the class object is rendered.

classObject () {

            const {color, enabled, theme, typeBold, disabled} = this;

            return {
                'vue-switcher': true,
                ['vue-switcher--unchecked']: !enabled,
                ['vue-switcher--disabled']: disabled,
                ['vue-switcher--bold']: typeBold,
                ['vue-switcher--bold--unchecked']: typeBold && !enabled,
                [`vue-switcher-theme--${theme}`]: color,
                [`vue-switcher-color--${color}`]: color,
            };

        }
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].