react-loading-indicators
A light-weight library providing a collection of easy to use loading indicators for your React projects. Waiting for a response has to be fun🥳.
Built with Typescript. Compatible with react version >=16.8.0.
View DEMO.
Installation
npm install react-loading-indicators
or
yarn add react-loading-indicators
Components
<Atom />
<Commet />
<CircularProgress />
<FourSquare />
<Mosaic />
<Riple />
<Seek />
Examples
Import an individual loader
import React from "react";
import { Atom } from "react-loading-indicators";
const Component = () => <Atom />;
export default Component;
OR Import default loader
import React from "react";
import Loader from "react-loading-indicators";
const Component = ({ variant, color, size }) => (
<Loader variant={variant} color={color} size={size} />
);
export default Component;
Props
Each of these components will accept the following optional props.
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 |
What do these props do?
size
- Sets the size of the loader.
color
- Sets the color of the loader.
style
- Applies CSS styles to the loader
text
- Displays message in the loader.
textColor
- Sets the color of text message in the loader.
The CircularProgress
component has a variant
prop(also optional). Choose between variations of a circular loader that you want:
variant | string | disc | disc, split-disc, dotted, bubble-dotted |
How to resize
You can resize loader to fit into your needs with the size
prop that accepts predefined string input.
You can further customize size to your own preferences by setting fontSize
in the style prop of the loader. The style prop is an object that allows you to add your own css. Including fontSize
in the style object will evenly alter size of the loader.
const Component = () => <Commet style={{ fontSize: "10px" }} />;
License
Distributed under the MIT License. See LICENSE
for more information.
Contact
@smitterhane