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 🙏

© 2022 – Pkg Stats / Ryan Hefner

react-indicators

v0.3.15

Published

Simple, responsive, canvas-based indicators that you can use to communicate the progress of loaders, timers or whatever else you might need a progress indicator for.

Downloads

362

Readme

react-indicators

npm NPM npm Coveralls github CircleCI Snyk Vulnerabilities for GitHub Repo

Simple, responsive, canvas-based indicators that you can use to communicate the progress of loaders, timers or whatever else you might need a progress indicator for.

~~In addition to the pre-built indicators, this library includes a generic Canvas component that you can pass a custom draw function to, or access the <canvas> element via a ref, and go nuts with your own canvas design goodness!~~

Update: I’ve moved the Canvas component to its own repo/package because I was finding myself needing it for cases where I didn’t need the indicators. This package now relies on react-canvas-wrapper as a dependency. You can check it out here: react-canvas-wrapper

Install

Using npm:

npm install --save react-indicators

Using Yarn:

yarn add react-indicators

Once you’ve added react-indicators to your project, you can use it just like you would any other package you have installed.

// using ES6 modules
import { CircleIndicator } from 'react-indicators';

// using CommonJS modules
var CircleIndicator = require('react-indicators').CircleIndicator;

Indicators

The library consists of two common indicator components, BarIndicator and CircleIndicator. Below are examples of how you can use each component, along with the properties that they support.

<CircleIndicator />

Properties

  • progress:Number - Progress to represent in the indicator, 0 to 1. (Default: 0)
  • size:Number - Size, width/height, of the indicator. (Default: 30)
  • fill:String - Color used to fill the progress portion indicator. (Default: 'transparent')
  • fillBackground:String - Color used to fill the empty, non-progress, portion of the indicator. (Default: 'transparent')
  • stroke:String - Color for the stroke of the progress portion of the indicator. (Default: 'black')
  • strokeBackground:String - Color for the stroke of the empty, non-progress, portion of the indicator. (Default: 'white')
  • strokeWidth:Number - Width of the stroke. (Default: 2)

Example

import { CircleIndicator } from 'react-indicators';

...

  render() {
    const {
      progress,
    } = this.state;

    return (
      <CircleIndicator progress={progress} />
    );
  }

...

<BarIndicator />

Properties

  • progress:Number - Progress to represent in the indicator, 0 to 1. (Default: 0)
  • width:Number - Width of the indicator @ 1x. (Default: 45)
  • height:Number - Height of the indicator @ 1x. (Default: 5)
  • color:String - Color of the progress portion of the indicator. (Default: 'black')
  • backgroundColor:String - Background color of the empty, non-progress, portion of the indicator. (Default: 'transparent')

Example

import { BarIndicator } from 'react-indicators';

...

  render() {
    const {
      progress,
    } = this.state;

    return (
      <BarIndicator progress={progress} />
    );
  }

...

Responsive Canvas

All components recognize the devicePixelRatio of the device/browser they are running in, so the canvas is properly sized in order to keep the graphics crisp and clean. So, feel free to set the size or dimensions based on a 1x scale and the component will adjust those accordingly.

License

MIT © Ryan Hefner