# react-use-dropdown

> Simple hook that you can use to build dropdowns

Latest version **1.0.1** (published 2019-12-17) · ISC license · 0 weekly downloads

## Install

```sh
npm install react-use-dropdown
pnpm add react-use-dropdown
yarn add react-use-dropdown
bun add react-use-dropdown
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2019-12-17 |
| First published | 2019-11-24 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 2.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | user93 |

## Links

- npm: https://www.npmjs.com/package/react-use-dropdown
- npm.io page: https://npm.io/package/react-use-dropdown

## Dependencies (1)

- [react](https://npm.io/package/react.md) ^16.12.0

## Recent versions

- 1.0.1 (latest) — 2019-12-17
- 1.0.0 — 2019-11-24

## README

# react-use-dropdown

Simple hook that you can use to build dropdowns

## Why?

This hook provides boolean value dropdown which you can use to show dropdown and couple of
functions to change that value. It also set dropdown boolean to false when click outside or
when esc key is pressed. Since this functionality is needed by most dropdown this hook makes it
easier to build custom dropdowns.

## Usage

```
$ npm i react-use-dropdown
```

```javascript
import { useRef } from "react";
import useDropdown from "react-use-dropdown";

const outerRef = useRef(null);
const { dropdown, toggleDropdown } = useDropdown(outerRef);

const DropdownContainer = () => (
  <StyledOuterComponent ref={outerRef}>
    {dropdown && <Dropdown />}
  </StyledOuterComponent>
);

export default DropdownContainer;
```

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