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.
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
importReact,{useState}from"react";
import{BarsLoader}from'react-loaders-kit';
//or
importBarsLoaderfrom'react-loaders-kit/lib/bars/BarsLoader';// Recommended to reduce bundle size
constMyWonderfulComponent=()=>{
const[loading,setLoading]=useState(true);
constloaderProps={
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: number
colors: string[]
50
['#5e22f0', '#f6b93b']
<AtomLoader />
size: number
colors: string[]
duration: number
50
['#5e22f0', '#5e22f0']
1
<BarsLoader />
size: number
colors: string[]
duration: number
35
['#5e22f0', '#f6b93b']
1
<BarsLoader2 />
size: number
color: string
duration: number
40
'#5e22f0'
1.5
<BatteryLoader />
size: number
color: string
duration: number
50
'#5e22f0'
0.7
<BlobLoader />
size: number
color: string
duration: number
40
'#5e22f0'
1.3
<BlurrySquareLoader />
boxNumber: number
colors: string[]
duration: number
3
['#5e22f0', '#5e22f0', '#5e22f0']
0.7
NOTE: The number of boxes must correspond to the number of colors in the array