3.0.0 • Published 5 years ago

vue-circle-counter v3.0.0

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

VUE CIRCLE COUNTER

This Vue component creates a circular counter. The angle, colors, strokewidth, spacing between dashes and direction can all be controlled through properties.

Examples

Examples of vue-circle-counter

Sample code on codesandbox

Browser example on Codepen

Project setup

With a package manager

# npm
$ npm install vue-circle-counter

#yarn
$ yarn add vue-circle-counter

For the browser

<script src="unpkg.com/vue-circle-counter@latest/dist/circleCounter.umd.min.js"></script>

How it works

The component generates an SVG element with default width and height of 100% (outer diameter of the counter). Two dashed strokes are overlayed: the bottom one controlled by stroke and dashCount and the top one by activeStroke and activeCount. You can reverse the direction to counter-clockwise and rotate the start angle (default is right / 3 o'clock).

Properties

propdescriptiondefaultoptions
sizewidth and height of element10remString
dashCountTotal number of dashes60Natural number
activeCountNumber of dashes on top10Natural number
strokeWidthBottom stroke as a percentage of the radius200 to 100
activeWidthTop stroke as a percentage of the radius200 to 100
strokeStroke color of the bottom dasheslightgreycolor
activeStrokeStroke color of the top dashesdodgerbluecolor
dashSpacingFraction of width taken up by space between dashes1/40 to 1
rotateDegrees rotation for start angle (0 = right)-90-360 to 360
reverseReverse the direction of counting (true = counter-clockwise)falsefalse or true
textText string to display inside SVG""String

License

MIT Open Source License