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-loading-indicators

v0.2.3

Published

Simply elegant light-weight loading indicators for react applications

Downloads

3,184

Readme

react-loading-indicators

A library of usable and wonderful loading indicators to communicate a behind scenes progress to system users.

Built with Typescript. Compatible with react version >=16.8.0(since hooks).

A demo for your insights

A glimpse of what is wrapped 🎁. See DEMO page.

Installation

npm install react-loading-indicators

Components

<Atom />
<Commet />
<OrbitProgress />
<GlidingBlink />
<FourSquare />
<TrophySpin />
<ThreeDot />
<LifeLine />
<Mosaic />
<Riple />
<Slab />

Heads Up 📢

The following components were renamed:

  • ~~<CircularProgress />~~ - <OrbitProgress />
  • ~~<Seek />~~ - <ThreeDot />
  • ~~<GlidingBlink />~~ - <BlinkBlur />
  • ~~<Twist />~~ - <TrophySpin />
  • ~~<Pulse />~~ - <LifeLine />

Examples

Importing a loading indicator

import React from "react";
import { Atom } from "react-loading-indicators";
/* 
| OR directly pull it 😎
| import Atom from "react-loading-indicators/dist/Atom";
*/

const Loading = () => <Atom text="Loading..." />;

export default Loading;
<Suspense fallback={<Loading />}>
	<Albums artistId={artist.id} />
</Suspense>

Side note: You can use suspense for data fetching other than lazy loading.

Lighter build

This library is fairly small. However, you might be turbo-charged to make bundle size of your project as small as possible. You can directly include a loading indicator you want to ensure it is the only thing included from the library:

import React from "react";
import OrbitProgress from "react-loading-indicators/dist/OrbitProgress";

const Loading = () => (
	<OrbitProgress variant="track-disc" color="crimson" size="small" />
);

export default Loading;

Props

Each of these components will accept the following optional props.

| Name | DataType | Default Value | Possible Values | | :-------: | :-------------------: | :-------------------: | :---------------------------------------------------------------------------------------------------------: | | size | string | medium | small, medium, large | | color | string or array | limegreen | CSS color values | | style | object | null | CSS styles(in Reactjs format) | | text | string or boolean | false | Boolean value or any string | | textColor | string | undefined | CSS color values | | speedPlus | number | 0 | Number in the range -5 through 5 | | easing | string | default ease function | CSS easing function |

What do these props do?

  • size - Sets the size of the loading indicator.
  • color - Sets the color of the loading indicator.
  • style - Applies CSS styles to the loading indicator
  • text - Displays message in the loading indicator.
  • textColor - Sets the color of text message in the loading indicator.
  • speedPlus - Controls speed of animation. Negative values slows down. Positive numbers speeds up animation. 0 is normal speed.
  • easing - Controls the smoothness of the animation, altered with values such as linear, ease-in.

Some components accept a variant prop, Specifically <OrbitProgress /> and <ThreeDot />. This lets you choose a variation of a loading indicator that you want.

| Name | DataType | | :-----: | :------: | | variant | string |

<OrbitProgress /> has the following variants: dotted, bubble-dotted, disc, split-disc, track-disc. Defaults to disc. <ThreeDot /> has the following variants: pulsate, windmill, bob, brick-stack. Defaults to pulsate. See DEMO to visualize.

How to resize

You can resize a spinner to fit into your needs with the size prop that accepts predefined string input. If this is not enough, you can give a loading indicator a fontSize property via the style prop. The style prop is an object that allows you to add your own css. Including fontSize in the style object will evenly alter the animation's size, e.g

const Loading = () => <ThreeDot style={{ fontSize: "8px" }} />;

License

Distributed under the MIT License. See LICENSE for more information.

Contact

@smitterhane