# ns-react-block-ui

> A react component for blocking UI.

Latest version **1.0.13** (published 2023-04-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install ns-react-block-ui
pnpm add ns-react-block-ui
yarn add ns-react-block-ui
bun add ns-react-block-ui
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.13 |
| Published | 2023-04-12 |
| First published | 2022-09-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 86.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Nutthawut Kongsopa |
| Maintainers | nutthawutkongsopa |
| Keywords | React, BlockUI, ReactComponent, Component |

## Links

- npm: https://www.npmjs.com/package/ns-react-block-ui
- Repository: https://github.com/nutthawutkongsopa/ns-react-block-ui
- Homepage: https://nutthawutkongsopa.github.io/ns-react-block-ui
- Issues: https://github.com/nutthawutkongsopa/ns-react-block-ui/issues
- npm.io page: https://npm.io/package/ns-react-block-ui

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^2.4.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.13 (latest) — 2023-04-12
- 1.0.12 — 2022-12-06
- 1.0.11 — 2022-12-02
- 1.0.10 — 2022-12-02
- 1.0.9 — 2022-12-02
- 1.0.8 — 2022-11-23
- 1.0.6 — 2022-11-03
- 1.0.5 — 2022-11-03
- 1.0.4 — 2022-09-21
- 1.0.3 — 2022-09-20
- 1.0.2 — 2022-09-20
- 1.0.1 — 2022-09-20
- 0.2.6 — 2022-09-20
- 0.2.4 — 2022-09-19
- 0.2.2 — 2022-09-19
- … 11 more at https://npm.io/package/ns-react-block-ui/versions

## README

# ns-react-block-ui 
A react component for blocking UI.
<hr/>

### Document
https://nutthawutkongsopa.github.io/ns-react-block-ui

### Installation 🛠️
```console
npm install ns-react-block-ui
```
[![Npm package total downloads](https://badgen.net/npm/dt/ns-react-block-ui)](https://npmjs.com/package/ns-react-block-ui)

### Basic Using ✅
```javascript
import { BlockUI } from "ns-react-block-ui";
```
```javascript
<BlockUI blocking={isBlocking}>
  ...
  <OtherComponent />
</BlockUI>
```
### Global Blocking (Context) 🌟
index.js
```javascript
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.scss';
import App from './App';
import { BlockUIProvider } from 'ns-react-block-ui'

const root = ReactDOM.createRoot(
  document.getElementById('root') as HTMLElement
);
root.render(
  <React.StrictMode>
    <BlockUIProvider loader="default">
      <App />
    </BlockUIProvider>
  </React.StrictMode>
);

```
SomeComponent.js
```javascript
import { useBlockUIContext } from 'ns-react-block-ui'

SomeComponent = () => {
  const { setBlockUI } = useBlockUIContext();
  const blockUI = () => {
    setBlockUI({ blocking: true });
  };

  return (
    <>
      <button onClick={() => blockUI()}>Block Screen</button>
    </>
  );
};
```
### Properties 🍀
BlockUI Properties
```javascript
{
    blocking?: boolean;
    message?: string | ReactNode;
    overlayStyle?: CSSProperties;
    loader?: "default" | ReactNode;
    style?: CSSProperties;
    className?: string;
    mode?: "contain" | "stretch" | "full-screen";
    cursor?: "inherit" | "wait" | "default" | "progress" | "not-allowed";
    hideScroll?: boolean;
}
```
BlockUI Context Data
```javascript
{
    blocking?: boolean;
    message?: string;
    loader?: ReactNode;
}
```
### Compatible Version ⚖️
| Version | React Version | Node Version |
| ------- | ------------- | ------------ |
| 0.1.8   | 16.13.1       | >=14.0.0     |
| 0.1.11  | 16.13.1       | >=14.0.0     |
| 0.2.4   | 16.13.1       | >=14.0.0     |
| 0.2.6   | >=16.13.1     | >=14.0.0     |
| 1.x.x   | >=16.13.1     | >=14.0.0     |

---
_Source: https://npm.io/package/ns-react-block-ui · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
