0.1.3 • Published 4 years ago

react-loaders-kit v0.1.3

Weekly downloads
428
License
MIT
Repository
github
Last release
4 years ago

React Loaders Kit

npm version license

A simple yet robust and comprehensive collection of loading animations made with React.js based on inspiration from designers and developers on codepen.

This package was made using the Emotion css library.

Demo Page

All loaders can be found on the demo page

Installation

With npm:

npm install --save react-loaders-kit

With Yarn:

yarn add react-loaders-kit

Usage

All loaders come with their own default properties. You have the option to overwrite these properties by passing in your own props into the loaders.

IMPORTANT: All loaders accept a loading prop as a boolean that is required. Without passing the loading prop, an error is thrown. The loader will render none if loading is false.

Example

import React, {useState} from "react";
import { BarsLoader } from 'react-loaders-kit';

//or

import BarsLoader from 'react-loaders-kit/lib/bars/BarsLoader'; // Recommended to reduce bundle size

const MyWonderfulComponent = () => {
    const [loading, setLoading] = useState(true);

    const loaderProps = {
        loading,
        size: 35,
        duration: 1,
        colors: ['#5e22f0', '#f6b93b']
    }

    return (
        <BarsLoader {...loaderProps} />
    )
}

Available Loaders, PropTypes, and Default Values

Common default props for all loaders:

loading: true;
pause: false;

IMPORTANT: The loading prop is REQUIRED and needs to be passed for the loader to display.

pause props

All loaders accept a pause prop which is a boolean. If pause is true, the animation is paused else it deafults to playing.

color & colors props

Some loaders accept a color prop which is a color hash string in the format of #XXXXXX or #XXX.

Other loaders which have more customization accept a colors prop which is a string array of colors in the format of ['#XXXXXX', '#XXXXXX', ...] or ['#XXX', '#XXX', ...].

All loaders

The tables below contain the default values of each prop on all loaders.

<AlternatingOrbitsLoader />

size: numbercolors: string[]
50'#5e22f0', '#f6b93b'

<AtomLoader />

size: numbercolors: string[]duration: number
50'#5e22f0', '#5e22f0'1

<BarsLoader />

size: numbercolors: string[]duration: number
35'#5e22f0', '#f6b93b'1

<BarsLoader2 />

size: numbercolor: stringduration: number
40'#5e22f0'1.5

<BatteryLoader />

size: numbercolor: stringduration: number
50'#5e22f0'0.7

<BlobLoader />

size: numbercolor: stringduration: number
40'#5e22f0'1.3

<BlurrySquareLoader />

boxNumber: numbercolors: string[]duration: number
3'#5e22f0', '#5e22f0', '#5e22f0'0.7
NOTE: The number of boxes must correspond to the number of colors in the array

<BouncyBallsLoader />

size: numbercolors: string[]duration: number
40'#5e22f0', '#5e22f0', '#5e22f0'0.4

<BrokenCirclesLoader />

size: numbercolors: string[]
40'#5e22f0', '#5e22f0', '#5e22f0', '#5e22f0'

<CircleFadeLoader />

size: numbercolor: stringduration: number
40'#5e22f0'0.5

<CirclePopLoader />

size: numbercolor: stringduration: number
120'#5e22f0'1

<ClockLoader />

size: numbercolors: string[]duration: number
40'#5e22f0', '#5e22f0'1

<DotsLoader />

size: numbercolor: stringduration: number
45'#5e22f0'2

<DoubleSquareLoader />

size: numbercolors: string[]duration: number
30'#5e22f0', '#5e22f0'2.5

<DrawWaveLoader />

size: numbercolor: stringduration: number
50'#5e22f0'0.8

<DyingLightLoader />

size: numbercolors: string[]
35'#5e22f0', '#5e22f0', '#5e22f0'

<EightBitLoader />

size: numbercolor: stringduration: number
60'#5e22f0'1

<ElasticCircleLoader />

size: numbercolor: stringduration: number
40'#5e22f0'1

<FillCircleLoader />

size: numbercolors: string[]
60'#5e22f0', '#5e22f0'

<FillSquareLoader />

size: numbercolors: string[]duration: number
40'#5e22f0', '#5e22f0', '#5e22f0', '#5e22f0'1

<FlipLoader />

size: numbercolor: stringduration: number
45'#5e22f0'1

<FlippingCubeLoader />

size: numbercolors: string[]
35'#5e22f0', '#5e22f0', '#5e22f0', '#5e22f0'

<GooeyLoader1 />

size: numbercolor: string
60'#5e22f0'

<GooeyLoader2 />

size: numbercolor: string
60'#5e22f0'

<GooeyCircleLoader />

size: numbercolors: string[]
80'#f6b93b', '#5e22f0', '#ef5777'

<HelixLoader />

numberOfDots: numbernumberOfDots: numbercolors: string[]duration: number
9010'#5e22f0', '#f6b93b'1.5

<HydrogenLoader />

size: numbercolors: string[]duration: number
45'#5e22f0', '#5e22f0'0.6

<HypnosisLoader />

size: numbercolors: string[]duration: number
50'#ffffff', '#5e22f0'2

<BlurrySquareLoader />

size: numberjellyNumber: numbercolors: string[]duration: number
1505'#5e22f0', '#5e22f0', '#5e22f0', '#5e22f0', '#5e22f0'0.6

NOTE: The number of jellies must correspond to the number of colors in the array

<KissyBallsLoader />

size: numbercolors: string[]duration: number
60'#5e22f0', '#5e22f0'0.5

<LineLoader />

lineWidth: numbercolor: stringduration: number
25'#5e22f0'2

<LinneardLoader />

size: numbercolors: string[]duration: number
130'#5e22f0', '#ef5777'0.8

<LiquidLoader />

size: numbercolor: stringduration: number
40'#5e22f0'2

<MovingSquareLoader />

size: numbercolors: string[]duration: number
60'#5e22f0', '#5e22f0'1

<NotepadLoader />

size: numbercolors: string[]duration: number
40'#5e22f0', '#5e22f0'2

<PingPongLoader />

size: numbercolors: string[]duration: number
90'#5e22f0', '#5e22f0'0.8

<PipLoader />

size: numbercolor: stringduration: number
15'#5e22f0'0.8

<PulseBubbleLoader />

size: numbercolors: string[]
55'#5e22f0', '#5e22f0', '#5e22f0'

<RotatingBoxesLoader />

size: numberboxBorderWidth: numbercolors: string[]duration: number
102'#ffffff', '#ffffff', '#5e22f0', '#5e22f0'3

<RotatingCircleLoader />

size: numbercolors: string[]duration: number
20'#5e22f0', '#5e22f0', '#f6b93b', '#ef5777'1.2

<SlicesLoader />

size: numbercolor: stringduration: number
80'#5e22f0'1

<SlidingCubeLoader />

size: numbercolors: string[]duration: number
10'#5e22f0', '#5e22f0'1

<SphereLoader />

size: numbercolor: stringduration: number
40'#5e22f0'1

<SpinningCircleLoader />

size: numbercolors: string[]
50'#5e22f0', '#ffffff'

<SpinningOrbitLoader />

size: numbercolors: string[]
50'#5e22f0', '#5e22f0', '#5e22f0', '#5e22f0'

<SwingingCubeLoader />

size: numbercolors: string[]duration: number
18'#5e22f0', '#5e22f0', '#5e22f0'1

<SwitchingCubeLoader />

size: numbercolors: string[]duration: number
20'#5e22f0', '#5e22f0', '#5e22f0'1

<TextureLoader />

size: numbercolor: stringduration: number
40'#5e22f0'0.7

<VolumeLoader />

size: numbercolors: string[]duration: number
35'#5e22f0', '#ffffff'0.6

<VortexLoader />

size: numbercolors: string[]duration: number
40'#5e22f0', '#5e22f0'2

<WaveLoader />

size: numbercolor: stringduration: number
40'#5e22f0'0.6

Contributing

  • Pull requests and ⭐ stars are always welcome
  • For bugs and feature requests, please create an issue

License

MIT