GithubHelp home page GithubHelp logo

hane-smitter / react-loading-indicator Goto Github PK

View Code? Open in Web Editor NEW
27.0 1.0 3.0 2.34 MB

A library of wonderful loading indicators for your react project

Home Page: https://react-loading-indicators.netlify.app

License: MIT License

JavaScript 4.32% SCSS 37.09% TypeScript 58.60%
loader npm react typescript react-loading-indicators css node loading-indicator react-loading hacktoberfest

react-loading-indicator's Introduction

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 />
<BlinkBlur />
<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;
Example usage
<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

react-loading-indicator's People

Contributors

hane-smitter avatar prajwalkulkarni avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

react-loading-indicator's Issues

Modern disc spinner

Update OrbitProgress disc spinner to a modern animation like the google's corcular loader

New loading indicator

I'd want to work on adding a new loading indicator that consists of 4 small squares that are rotated about 45 deg about the x-axis. These individual squares move to and fro on their x-axis and rotate 90deg about their pivot point.
Could you kindly assign me this under the hacktober-accepted label?

npm storybook is not a valid npm command

When I try running this project locally using npm start, it is unable to start the server, because npm storybook is not a valid command, when I checked the package.json, there were no commands corresponding to start, this would not allow developers to run and see their additions/changes locally, I'd like to take up this issue and fix it.

Easing prop

Supply easing prop to components to allow customizability to an animations easing

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.