New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-progress-bars

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-progress-bars

![alt text](docs/progressbar.png)

latest
Source
npmnpm
Version
1.3.1
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

react-multi-progress

alt text

A simple, typed react progress bar that allowes multiple layers in different colors.

Installation

Install with npm:

  • npm install react-progress-bars --save

You can now import react-progress-bars as a normal package installed from npm like so:

import MultiProgress from 'react-progress-bars'
...

You can also import the type definitions if you're using TypeScript like so:

import MultiProgress, { IMultiProgressProps } from 'react-progress-bars'
...

Available props

AttributeTypeOptionalDefaultDescription
backgroundColorstringyes#ffffffBackground color of the progress bar
borderstringyesnoneset a border around the progress bar, e.g. 1px solid red
elementsProgressElement[]nononeSet the color and size of each element, see "ProgressElement" below.
heightnumberyes10Height of the progress bar in px
roundboolyestrueWheter the ends of the progress bar container should be rounded
roundLastElementboolyestrueWheter the last progress element should be rounded on the right end
transitionTimenumberyes0.6Transition time in seconds to animate when the value changes. Set to 0 for no animation.
classNamestringyesCSS className passed onto the ProgressBar Container
componentElementTypeyesdivCustom element used to render progress elements, either a HTML tag name or React component accepting className, children, and element props, with element being the ProgressElement passed in. Be sure to spread the remaining props (see example) as style information is provided in this way (a data attribute)
type generic (see example)Record<string, any>yesRecord<string, never>Additional props to add to the definition of elements, for use with custom components

ProgressElement

AttributeTypeOptionalDescription
valuenumbernoLength of the element in % (0-100)
colorstringnoColor of the element (any css compatible format)
showPercentageboolyesShow the percentage as text in the ProgressElement
textColorstringyesColor of the percentage text (any css compatible format)
fontSizenumberyesfont size of the percentage text (in px)
classNamestringyesCSS className passed onto the ProgressElement

Example

Basic

import MultiProgress from "react-progress-bars";

function Progress() {
	return (
		<MultiProgress
			elements={[
				{
					value: 35,
					color: "blue",
				},
			]}
		/>
	);
}

Advanced

import MultiProgress, { ProgressComponentProps } from "react-progress-bars";

// for non-TS projects, remove this and other types
type ExtraData = { isBold: boolean };

function CustomComponent({
	children,
	element,
	...rest
}: ProgressComponentProps<ExtraData>) {
	return (
		<div
			{...rest} // adds all styles for rendering the progress bar
			style={{
				fontWeight: element.isBold ? 900 : 300,
			}}
		>
			{children}
		</div>
	);
}

function Progress() {
	return (
		<MultiProgress<ExtraData>
			transitionTime={1.2}
			elements={[
				{
					value: 15,
					color: "blue",
					isBold: false,
				},
				{
					value: 35,
					color: "rgb(100,0,0)",
					showPercentage: true,
					fontSize: 12,
					textColor: "white",
					isBold: true,
				},
				{
					value: 25,
					color: "black",
					showPercentage: true,
					textColor: "white",
					fontSize: 12,
					isBold: false,
					className: "my-custom-css-class",
				},
			]}
			height={15}
			backgroundColor="gray"
			border="1px solid red"
			className="my-custom-css-class"
			component={CustomComponent}
		/>
	);
}

License

react-progress-bars is licensed under the MIT License.

Contacto

LinkedIn hugo aragon

FAQs

Package last updated on 19 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts