# react-outside-component

> React component for handling outside clicks

Latest version **0.1.4** (published 2019-07-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-outside-component
pnpm add react-outside-component
yarn add react-outside-component
bun add react-outside-component
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.4 |
| Published | 2019-07-16 |
| First published | 2017-11-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 9.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Igor Machuzhak |
| Maintainers | fantua |
| Keywords | react, outside, component, click, event |

## Links

- npm: https://www.npmjs.com/package/react-outside-component
- Repository: https://github.com/fantua/react-outside-component
- Issues: https://github.com/fantua/react-outside-component/issues
- npm.io page: https://npm.io/package/react-outside-component

## Dependencies (2)

- [lodash](https://npm.io/package/lodash.md) ^4.17.4
- [prop-types](https://npm.io/package/prop-types.md) ^15.6.0

## Alternatives

- [async-exit-hook](https://npm.io/package/async-exit-hook.md) — 3.7M weekly downloads
- [evnty](https://npm.io/package/evnty.md) — 7.2K weekly downloads
- [eleventy-plugin-asciidoc](https://npm.io/package/eleventy-plugin-asciidoc.md) — 3.5K weekly downloads
- [@jswork/next-get2get](https://npm.io/package/@jswork/next-get2get.md) — 945 weekly downloads
- [@dashersw/axon](https://npm.io/package/@dashersw/axon.md) — 934 weekly downloads

## Recent versions

- 0.1.4 (latest) — 2019-07-16
- 0.1.3 — 2017-11-24
- 0.1.2 — 2017-11-24
- 0.1.1 — 2017-11-20
- 0.1.0 — 2017-11-19

## README

# react-outside-component
React component for handling outside clicks. Inspired by [reactstrap](https://github.com/reactstrap/reactstrap). 

[![npm version](https://img.shields.io/npm/v/react-outside-component.svg?style=flat-square)](https://www.npmjs.com/package/react-outside-component)

## Installation

```sh
yarn add react-outside-component
```

## Api

### Properties

```js
OutsideComponent.propTypes = {
    tag: PropTypes.string, // default 'div'
    isOpen: PropTypes.bool, // default true
    children: PropTypes.node,
    onClickOutside: PropTypes.func.isRequired,
};
```

## Example

```js
import React, { Component } from 'react';
import Outside from 'react-outside-component';

export default class CustomDropdown extends Component {
    
    constructor(props) {
        super(props);
        
        this.handleOutsideClick = this.handleOutsideClick.bind(this);
    }
    
    handleOutsideClick(e) {
        // ...
    }
    
    render() {
        return (
            <Outside tag="ul" className="dropdown-menu" onClickOutside={this.handleOutsideClick}>
                <li>Items..</li>
            </Outside>
        );
    }
}
``` 

## License

MIT

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