Socket
Socket
Sign inDemoInstall

react-spinner-loader

Package Overview
Dependencies
339
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-spinner-loader

An easy to use, simple multi-purpose react loader. Ability to show full page loading and inner section loading


Version published
Weekly downloads
111
increased by50%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Features

  • Lightweight
  • Out of the box loader
  • Full Page Loader, Inline Loader
  • Custom Loading Message
  • Custom Styling Options

Installation

With Yarn

yarn add react-spinner-loader

With npm

npm i --save react-spinner-loader

Documentation

You could view the documentation in Github Page as well.

Usage

react-spinner-loader is compatible with both Class and Functional React Components.

import Loader from 'react-spinner-loader';
const App = () => {
    const [loader, setLoader] = useState(true);
    return (
        <div>
            <Loader show = {loader}>
        </div>
    )
}

Available Custom Props

By default, react-spinner-loader comes up with the following properties. You could use the following to customize your loader out of the box.

PropOptionalDefaultPossible ValuesDescription
showNofalsetrue | falseTo Show/Hide Loader
typeYesinlineinline | box | body To show either full page or inline loader
messageYes - User Custom StringTo show Loading Message
stackYeshorizontalhorizontal | verticalTo decide the position of spinner and message
spinnerStyleYes Any Primary and Secondary Color. To change the color of spinner
spinnerSizeYes 40px Size in px | em | rem To change the size of spinner
messageStyleYes #101010 (Inline)
#FFFFFF (Other)
CSS Properties To change the style of messages

Example

Prop : type

To show inline loaders, use type = "inline". This is the default value.

<Loader show = {loader} type = "inline" />

View on Sandbox

To show a full page loader with blur background, use type = "body"

<Loader show = {loader} type = "body" />

View on Sandbox

To show a full page loader without blur background, then use type = "box"

<Loader show = {loader}  type = "box" />

View on Sandbox

Prop : message and messageStyle

Many times, we would want to provide a loading message along with the loader to help user understand why is it taking a lot of time to load the data.
To achieve this, you could pass custom loading string with message prop.
Alternatively, you could also configure the message styling with messageStyling prop.

<Loader 
    show = {loader}
    message = "Loading Message"
    messageStyling = {{
        color: blue
    }}
/>

Prop : stack

This prop would help to place message either horizontally or vertically with respect to the spinner.

<Loader show = {loader}  stack = "vertical"/>

View on Sandbox

Prop : spinnerStyle

Want to align the spinner with your website theme? You could always use spinnerStyle prop to customize the loader colors.

<Loader
    show = {loader} 
    spinnerStyle = {{
        primary: '#46B597',
        secondary: '#2D866D'
    }}
/>

Prop : spinnerSize

Increase or Decrease the spinner size with spinnerSize

<Loader show = {loader} spinnerSize = "50px"/>

Keywords

FAQs

Last updated on 10 May 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc