1.2.1 • Published 5 years ago

@pderas/vue2-toggle v1.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

Vue Toggle

A vue.js component for a toggle input.

How to initialize Vue Toggle

Vue toggle is built as a vue plugin. It can be initialized just as the Vue documentation states.

import Toggle from "@pderas/vue2-toggle";

// defaults
Vue.use(Toggle, {
    altColor:   '#ccc',
    color:      '#2196F3',
    labels:     {
        true_label:     'On',
        false_label:    'Off'
    },
    useLabels:  true,
    type:       'round'
});

Usage

Creation

A vue toggle is easily created and can be bound to data with v-model.

<toggle></toggle>

Properties

PropertyRequiredTypeDefaultDescription
alt-colorfalseString'#ccc'The color of the toggle when unchecked
colorfalseString'#2196F3'The color of the toggle when checked
labelsfalseObject{ true_label: 'on', false_label: 'off' }The labels to use when use-labels is enabled
typefalseString'round'The type of style to use for the toggle
use-labelsfalseBooleantrueUse on/off labels on the toggle
valuefalseBooleanfalseValue for the input, can be used with v-model
Available Types
  1. round
  2. rectangle

Styling

Styling is currently limited, but can be expanded in the future.

License

This project is covered under the MIT License. Feel free to use it wherever you like.

1.2.1

5 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago