1.0.3 • Published 4 years ago

react-multicolor-circular-progress-bar v1.0.3

Weekly downloads
6
License
MIT
Repository
github
Last release
4 years ago

react-multicolor-circular-progress-bar

NPM JavaScript Style Guide

A React component that displays a customisable circular or semicircular progress bar.

The bar can display multiples colors segments in the circle, with variable degrees and gradient color between transitions.

alt text

Install

Install with npm:

npm install --save react-multicolor-circular-progress-bar

Examples

For examples and usage see example folder.

Usage

import React from 'react';

import CircularBar from 'react-multicolor-circular-progress-bar';

const Example = (props) => (
    <CircularBar
      scale={2}
      angleTransition={[180]}
      colors={['#ff0000','#00ff00']}
      stroke={ {color:'#eee', width:5}}
    />
);

export default Example;

Naming

alt text

Props

NameTypeRequiredDefaultRangeDescription
fontFamilystringfalseroboton/aThe font-family used in the component.
scalenumber or stringfalse1>0General scale of all elements in progress bar.
gapGradientnumberfalse1>=0The size in degrees of color gradient applied between color transition. The max value depends of angles of adjacent sectors.
angleTransitionArray of numbersfalse 180 >0º and <360º or 180º for semicircularSet the angle position where the segment change of color.
colorsArray of stringtrue '#ff0000', '#00ff00' Valid hex color codeSet the segments colors. The array must have one more element than angleTransition array.
semiCircularbooleanfalsefalsen/aChange between circular or semicircular mode.
titleObjectfalsen/an/aSet the title properties. See title props.
percentObjecttruen/an/aSet the percent properties. See percent props.
imageObjectfalsen/an/aSet the image properties. See image props.
strokeObjecttruen/an/aSet the stroke properties. See stroe props.
ringObjectfalsen/an/aSet the ring properties. See ring props.

title

NameTypeRequiredDefaultRangeDescription
namestringtruen/an/aTitle text in the progress bar.
fontSizenumberfalse10n/aThe font-size in px.
fontWeightstringfalse'normal''normal', 'bold'The font-weight of font.
colorstringfalse'#00000099'Valid hex color codeThe font-color.
alignstringfalse'middle''start', 'middle', 'end'The font-alligment in the progress bar.
positionObjecttrue{ X: 0, Y: 0 }X: -50 to 50Y: -50 to 50 or -50 to 0 for semicircularx and y title position coordinates, in percentage, over progress bar. Take base of coordinates the align props selected ( start, middle or end of string).

percent

NameTypeRequiredDefaultRangeDescription
valuenumbertruen/a0 to 100Percent of gradient bar.
showValuebooleanfalsetruen/aShow or hide the percent value.
fontSizenumberfalse10n/aThe font-size in px.
fontWeightstringfalse'normal''normal', 'bold'The font-weight of font.
colorstringfalse'#00000099'Valid hex color codeThe font-color.
alignstringfalse'middle''start', 'middle', 'end'The font-alligment in the progress bar.
positionObjecttrue{ X: 0, Y: 0 }X: -50 to 50Y: -50 to 50 or -50 to 0 for semicircularx and y percent position coordinates, in percentage, over progress bar. Take base of coordinates the align props selected ( start, middle or end of string).

image

NameTypeRequiredDefaultRangeDescription
pathstringtruen/an/aPath of the image.
widthnumbertrue1n/aThe image width in px.
positionObjecttrue{ X: 0, Y: 0 }X: -50 to 50Y: -50 to 50 or -50 to 0 for semicircularx and y image position coordinates, in percentage, over progress bar.

stroke

NameTypeRequiredDefaultRangeDescription
colorstringtrue'#eee'Valid hex color codeThe color of stroke arc. Cover the bar percent from percent valure up to 360º.
widthnumbertrue5n/aThe width of progress bar.

ring

NameTypeRequiredDefaultRangeDescription
bgColorstringfalsen/aValid hex color codeThe color of inner progress bar.
colorstringtruen/aValid hex color codeThe color of ring inner gradient colors arc.
widthnumbertrue0n/aThe width of progress bar.
paddingnumberfalse0n/aThe gap between gradient color circle and ring.

License

MIT © Pablo Carmona <pablusmid@gmail.com>

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago