1.0.0 • Published 6 years ago

vue-segmented-control v1.0.0

Weekly downloads
30
License
-
Repository
-
Last release
6 years ago

Vue Segmented-Control

Segmented control for Vue.js

Vue Segmented Control visual

Demo

Demo on codesandbox.io

Installation

npm install vue-segmented-control

Usage

<template>
    <segmented-control
        :options="options"
        label="label"
        value="value"
        color="#fff"
        active-color="#333"
        :multiple="false"
        @select="onSelect"
    />
</template>
import SegmentedControl from 'vue-segmented-control'

export default {
    components: {
        SegmentedControl
    },
    data () {
        return {
            options: [
                { label: 'Red', value: 'red' },
                { label: 'Blue', value: 'blue' },
                { label: 'Green', value: 'green' }
            ]
        }
    },
    methods: {
        onSelect(optionsSelected) {
            // optionSelected: [{ label: '__', value: '__', ... }]
        }
    }
}

Documentation

Props:

PropertyTypeDefaultDescriptionRequired
optionsArray(Object)Items selectablestrue
labelString'label'Property that define the label
valueString'value'Property that define the value (should be unique)
colorString'#fff'Text color
activeColorString'#000'Background color of the selected items
multipleBooleanfalseSet to true to enable multiple selection