1.0.7 • Published 4 years ago

vue-circle-control-slider v1.0.7

Weekly downloads
7
License
MIT
Repository
-
Last release
4 years ago

VueCircleControlSlider

npm.io npm.io npm.io npm.io npm.io

It is Circle Control Slider component for Vue.js based on SVG view.

Table of contents

Installation

npm install --save vue-circle-control-slider

Usage

adding into main.js (global registration)

import Vue from 'vue'
import VueCircleControlSlider from 'vue-circle-control-slider'
import 'vue-circle-control-slider/dist/VueCircleControlSlider.css'
Vue.component('VueCircleControlSlider', VueCircleControlSlider); //global registration

or adding into your vue component (local registration)

<script>
import VueCircleControlSlider from 'vue-circle-control-slider'
export default{
    //*...some code...*//
    components: {
        //*...other components...*//
        VueCircleControlSlider //local registration in your component
    }
}
</script>

Functionality

  • svg based view
  • 2 way binding data value
  • defining min & max values
  • defining step size
  • animation while updating to new value on click by circle
  • touch devices support (touchmove)
  • available disabled events
  • sizes customization: exact and relative definitions
  • colors customization

Examples

When you have been register component with name VueCircleControlSlider so you can just use it right away:

...
<vue-circle-control-slider :value="pushSomeValue"/>
<vue-circle-control-slider @value="receiveSomeValue"/>
...

or customize some properties:

...
<vue-circle-control-slider
  :size="300"
  :min="0"
  :max="100"
  circleColor="black"
  progressColor="red"
  :knobRadius="20"
  :progressWidth="10"
  dial
  sign="%"
  dialTextColor="red"
/>
...

Interface

Props

PropsTypeDefaultDescription
valueNumber0init start value
sizeNumber200sets svg width & heigth
dialBooleanfalseshow value inside circle center
dialTextColorStringblacksets color of dial value inside circle center
dialFontSizeNumber50sets font-size of dial
signString""add sign to the end value row inside circle center for exampe it's "%" add persent sign
min            Number      0sets the minimum value
maxNumber100sets the maximum value
startAngleOffsetNumber90sets angle offset
offKnobBooleanfalseremove circle knob
offKnobNumberBooleanfalseremove value in circle knob
knobColorStringwhitesets knob color (unless explicitly stated, the props is the same as progressColor )
knobTextColorStringblacksets knob text color
knobBorderColorString#2196F3knob border color (unless explicitly stated, the props is the same as progressColor )
knobBorderWidthNumber3sets knob border with in px
knobRadiusNumber18sets knob radius in px
progressWidthNumber8sets width of circle progress in px
progressColorString#2196F3sets color of circle progress curve
circleWidthNumber6sets width of circle border in px
circleColorString#9E9E9Esets border color of circle
stepSizeNumber1sets the gap between the values
msNumber500sets the duration of the animation
disabledBooleanfalsedesabled events

Slots

There is no any slots available

Demo

License

MIT