react-linear-progressbar
v1.2.0
Published
linear progress bar built using ReactJS
Downloads
18
Maintainers
Readme
react-linear-progressbar
simple and customizable linear progress bar built using ReactJS
Installation
npm i react-linear-progressbar --save
Usage
import React, Component from 'react';
import Progressbar from 'react-linear-progressbar';
export default function MyComponent (props) {
const myConfig = {
containerStyle :{},
progressStyle:{},
stripe: false,
animate: false,
showLabel: true,
width: 40,
label: 40 + '%'
}
return <Progressbar config = {myConfig}/>;
}
Options
all the below configuration options (settings) should be passed as props in the form of an object named 'config' as shown in the example above.
containerStyle : either a css className or an object of styles. This indicates the styles for progress bar container
- Examples
- passing a css classname
<!-- style --> .sampleStyle { background-color: #000 !important; } <!-- config --> myConfig = { containerStyle : 'sampleStyle' ..... }
- passing an object of styles
<!-- style --> const sampleStyle = { 'backgroundColor': '#000 !important'; } <!-- config --> myConfig = { containerStyle : sampleStyle ..... }
progressStyle : similar to containerStyle property above, progressStyle is also either a css className or an object of styles. This indicates the styles for the progress bar (for example, color of the progress)
stripe : a boolean to specify the progress should have stripes
- possible values: true | false ; false by default
animate : a boolean to indicate if the the progress bar should have animation effect
- possible values: true | false ; false by default
showLabel : a boolean to indicate if the the progress bar percentage should be shown
- possible values: true | false ; true by default
width : a number which denotes the progress percentage
- possible values: any number >=0 && <=100
label : a string value which will display on the progress bar
- possible values: any string ; width + '%' by default
Test the code
- git clone https://github.com/yogeshkumar05/react-linear-progressbar.git
- npm install
- npm start
- launch http://localhost:3001/
Demo is published at
https://yogeshkumar05.github.io/react-linear-progressbar/