npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-progressive-bar

v1.2.3

Published

Create customise progress bar

Downloads

17

Readme

react-progressive-bar

A simple and customizable progress bar component for React. This package provides both a <ProgressBar /> component and a custom hook useProgressBar to manage progress state.

react-progressive-bar

Installation

To install the package, use npm or yarn: npm install react-progressive-bar or yarn add react-progressive-bar

Components

ProgressBar

A customizable progress bar component that can display both determinate and indeterminate states.

Props

  • progress (number): The progress percentage (0-100) for the progress bar. Defaults to 0.
  • height (number): Height of the progress bar in pixels. Defaults to 20.
  • color (string): Color of the progress bar. Defaults to 'blue'.
  • indeterminate (boolean): If true, the progress bar shows an indeterminate loading animation. Defaults to false.
  • animationDuration (string): Duration of the progress bar animation. Defaults to '0.5s'.
  • animationTimingFunction (boolean): If true, displays the progress percentage inside the progress bar. Defaults to false.
  • showPercentage (string): Duration of the progress bar animation. Defaults to '0.5s'.
  • percentageColor (string): Color of the percentage text inside the progress bar. Defaults to black.

useProgressBar

A custom hook to manage the progress state of the progress bar.

Props

  • initialValue (number): The initial value of the progress. Defaults to 0.
  • step (number): The amount by which the progress increases in each interval. Defaults to 10.
  • interval (number): The time interval (in milliseconds) at which the progress is updated. Defaults to 1000.

returns

  • progress (number): The current progress value.
  • setProgress (Function): A function to manually set the progress value.

Example Usage

import React from 'react';
import { ProgressBar, useProgressBar } from 'react-progressive-bar';

const MyComponent = () => {
  const { progress, setProgress } = useProgressBar(0, 10, 1000);

  return (
    <div className="flex flex-col gap-4 p-4">
      <h1>Testing Progress Bar</h1>
      <ProgressBar
        progress={progress}
        color="#4CAF50"
        height={24}
        showPercentage={true}
        indeterminate={false}
        percentageColor="black"
      />
      <button onClick={() => setProgress(0)}>Reset Progress</button>
    </div>
  );
};

export default MyComponent;

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Contributing

Feel free to open issues and pull requests to contribute to this project. Please ensure that your code follows the existing style and includes relevant tests.

Changelog

1.0.0

  • Initial release with ProgressBar component and useProgressBar hook.

1.1.0

  • Bug fixes in Initial release with ProgressBar component and useProgressBar hook.

1.2.0

  • Percentage and custom features added for ProgressBar and updated useProgressBar default values.