A collection of customizable loading animations for React applications.
Using npm:
npm install react-ui-loaders
Using yarn:
yarn add react-ui-loaders
- CircleLoader
- PulseLoader
- SpinnerLoader
- DotLoader
- RingLoader
- WaveLoader
- BounceLoader
- SquareLoader
- HeartbeatLoader
- OrbitLoader
- GlowLoader
- FullScreenLoader
Import the desired loader component and use it in your React component:
- Import the loader
import {
CircleLoader,
PulseLoader,
SpinnerLoader,
DotLoader,
RingLoader,
WaveLoader,
BounceLoader,
SquareLoader
HeartbeatLoader,
OrbitLoader,
GlowLoader
} from "react-ui-loaders";
- Add the loader to your JSX
<CircleLoader size={80} color="#cba6f7" thickness={4} speed={1} />
<PulseLoader size={80} color="#cba6f7" />
<SpinnerLoader size={80} color="#cba6f7" />
<DotLoader size={80} color="#cba6f7" />
<RingLoader size={80} color="#cba6f7" />
<WaveLoader size={80} color="#cba6f7" />
<BounceLoader size={80} color="#cba6f7" />
<SquareLoader size={80} color="#cba6f7" />
<HeartbeatLoader size={80} color="#cba6f7" />
<OrbitLoader size={80} color="#cba6f7" />
<GlowLoader size={80} color="#cba6f7" />
- Customize with props as needed
The FullScreenLoader component creates a full-screen overlay with the selected loader centered on the screen:
- Import the FullScreenLoader
import { FullScreenLoader } from "react-ui-loaders";
- Use state to control the loader's visibility
- Add the FullScreenLoader to your JSX, conditionally rendered based on the loading state
function MyComponent() {
const [isLoading, setIsLoading] = useState(false);
return (
<div>
{isLoading && (
<FullScreenLoader
loaderType="spinner"
size={80}
color="#ffffff"
backgroundColor="rgba(0, 0, 0, 0.7)"
isLoading={isLoading}
/>
)}
<button onClick={() => setIsLoading(!isLoading)}>
Toggle Loader
</button>
</div>
);
}
- Customize with props as needed
Prop |
Type |
Default |
Description |
size |
number |
40 |
Size of the loader in pixels |
color |
string |
'#61dafb' |
Color of the loader |
thickness |
number |
4 |
Thickness of the circle |
speed |
number |
1 |
Animation speed (1 is normal, 2 is twice as fast) |
Prop |
Type |
Default |
Description |
size |
number |
40 |
Size of the loader in pixels |
color |
string |
'#61dafb' |
Color of the loader |
Prop |
Type |
Default |
Description |
size |
number |
40 |
Size of the loader in pixels |
color |
string |
'#61dafb' |
Color of the loader |
Prop |
Type |
Default |
Description |
size |
number |
40 |
Size of the loader in pixels |
color |
string |
'#61dafb' |
Color of the loader |
Prop |
Type |
Default |
Description |
size |
number |
40 |
Size of the loader in pixels |
color |
string |
'#61dafb' |
Color of the loader |
Prop |
Type |
Default |
Description |
size |
number |
40 |
Size of the loader in pixels |
color |
string |
'#61dafb' |
Color of the loader |
Prop |
Type |
Default |
Description |
size |
number |
40 |
Size of the loader in pixels |
color |
string |
'#61dafb' |
Color of the loader |
Prop |
Type |
Default |
Description |
size |
number |
40 |
Size of the loader in pixels |
color |
string |
'#61dafb' |
Color of the loader |
Prop |
Type |
Default |
Description |
size |
number |
40 |
Size of the loader in pixels |
color |
string |
'#61dafb' |
Color of the loader |
Prop |
Type |
Default |
Description |
size |
number |
40 |
Size of the loader in pixels |
color |
string |
'#61dafb' |
Color of the loader |
Prop |
Type |
Default |
Description |
size |
number |
40 |
Size of the loader in pixels |
color |
string |
'#61dafb' |
Color of the loader |
Prop |
Type |
Default |
Description |
loaderType |
string |
'circle' |
Type of loader to display ('circle', 'pulse', 'spinner', 'dot') |
size |
number |
60 |
Size of the loader in pixels |
color |
string |
'#61dafb' |
Color of the loader |
thickness |
number |
- |
Thickness of the loader (for applicable types) |
speed |
number |
- |
Animation speed (for applicable types) |
backgroundColor |
string |
'rgba(0, 0, 0, 0.5)' |
Background color of the full-screen overlay |
isLoading |
boolean |
true |
Whether to display the loader |
ISC License
Contributions are welcome! Please feel free to submit a Pull Request.