# @coxy/react-click-outside

> React tracking click outside children & useEffect fot toggle

Latest version **2.0.2** (published 2022-10-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install @coxy/react-click-outside
pnpm add @coxy/react-click-outside
yarn add @coxy/react-click-outside
bun add @coxy/react-click-outside
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.2 |
| Published | 2022-10-08 |
| First published | 2019-04-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 15.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | dsshard |
| Maintainers | dsshard |
| Keywords | React, click outside, typescript, ts, events, dom |

## Links

- npm: https://www.npmjs.com/package/@coxy/react-click-outside
- Repository: https://github.com/dsshard/react-click-outside
- Homepage: https://github.com/dsshard/react-click-outside#readme
- Issues: https://github.com/dsshard/react-click-outside/issues
- npm.io page: https://npm.io/package/@coxy/react-click-outside

## Dependencies (1)

- [@coxy/utils](https://npm.io/package/@coxy/utils.md) 1.0.8

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 2.0.2 (latest) — 2022-10-08
- 2.0.1 — 2022-10-08
- 2.0.0 — 2022-10-08
- 1.0.3 — 2019-08-18
- 1.0.2 — 2019-08-16
- 1.0.1 — 2019-08-16
- 1.0.0 — 2019-04-20

## README

### React Validator

React tracking click outside children

Need react **>=17.0**

## Example

``` javascript
import React, { useState } from 'react';
import { ReactClickOutside, useToggle } from '@coxy/react-click-outside';

export default () => {
  const [isVisible, open, close] = useToggle(false');

  return (
    <div>

      <ClickOutside visible={isVisible} onClose={close}>
        <div>Popup data</div>
      </ClickOutside>

      <button onClick={open} type="button">
        Open
      </button>

    </div>
  );
};
```

### Api

**props:**
- visible [bool]
- onClose [fn]

---
_Source: https://npm.io/package/@coxy/react-click-outside · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
