New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

loading-wrapper

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

loading-wrapper

A React component that wraps a tree of components and renders it as a custom loading indicator

latest
Source
npmnpm
Version
1.0.5
Version published
Maintainers
1
Created
Source

Loading Wrapper

A React component that wraps a tree of components and renders a wrapper div element when provided when flag is true. The content can be blurred, overlayed, deactivated; and a custom loading indicator can be added in addition to aforementioned features.

Sample

Installation

npm install loading-wrapper

Usage

import React from 'react';
import { LoadingWrapper } from 'loading-wrapper';

const App = () => {
    const [loading, setLoading] = useState(false);

    const toggleLoading = () => setLoading(loading => !loading);

    return (
        <React.Fragment>
            <button onClick={toggleLoading}>Toggle Loading State</button>
                <LoadingWrapper
                    when={loading}
                    blur={2}
                    opacity={1}
                    indicator={<Spin size="large" />}
                    overlay="lightyellow"
                    cursor="progress"
                >
                    <SampleContent />
                </LoadingWrapper>
        </React.Fragment>
}

LoadingWrapper Props

PropTypeDefaultDescription
whenbooleanfalseControls when the following styles applied to the wrapped component
blurnumber2Pixel unit blur value for css blur() function
opacitynumber0.5Percentage unit opacity value for css opacity property
inactivebooleanfalseControls pointer-events and user-select css properties
overlaystringnoneBackground color of the wrapper component for custom indicator
cursorstringdefaultCursor value for css property cursor when mouse hovered on LoadingWrapper component
indicatorJSX.ElementnullCustom indicator that is rendered in the center of LoadingWrapper when = true

Keywords

loading

FAQs

Package last updated on 27 Jun 2021

Did you know?

Socket

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