# react-simple-dropdown

> Non-prescriptive React.js dropdown toolkit

Latest version **3.2.3** (published 2018-08-03) · ISC license · 0 weekly downloads

## Install

```sh
npm install react-simple-dropdown
pnpm add react-simple-dropdown
yarn add react-simple-dropdown
bun add react-simple-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 | 3.2.3 |
| Published | 2018-08-03 |
| First published | 2015-07-02 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 2.2 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 221 |
| Author | Timothy Kempf |
| Maintainers | fauntleroy |
| Keywords | react, react-component, component, dropdown |

## Links

- npm: https://www.npmjs.com/package/react-simple-dropdown
- Repository: https://github.com/Fauntleroy/react-simple-dropdown
- Issues: https://github.com/Fauntleroy/react-simple-dropdown/issues
- npm.io page: https://npm.io/package/react-simple-dropdown

## Dependencies (2)

- [classnames](https://npm.io/package/classnames.md) ^2.1.2
- [prop-types](https://npm.io/package/prop-types.md) ^15.5.8

## 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

- 3.2.3 (latest) — 2018-08-03
- 4.0.0-alpha.8 (next) — 2018-11-03
- 4.0.0-alpha.7 (alpha) — 2017-10-11
- 3.2.3-alpha.1 — 2018-08-03
- 3.2.2 — 2018-08-03
- 3.2.2-alpha.1 — 2018-08-03
- 3.2.1 — 2018-08-02
- 4.0.0-alpha.6 — 2017-10-10
- 4.0.0-alpha.5 — 2017-10-10
- 4.0.0-alpha.4 — 2017-10-10
- 4.0.0-alpha.3 — 2017-10-08
- 4.0.0-alpha.2 — 2017-10-07
- 4.0.0-alpha.1 — 2017-10-06
- 3.2.0 — 2017-09-10
- 3.2.0-alpha.2 — 2017-08-27
- … 20 more at https://npm.io/package/react-simple-dropdown/versions

## README

## React Simple Dropdown

Non-prescriptive React.js dropdown toolkit.

[See it in action (Demo)](http://fauntleroy.github.io/react-simple-dropdown/)

### Installation

This module is designed for use with [Browserify](http://browserify.org) (but should work with anything CommonJS compatible). You can easily install it with [npm](http://npmjs.com):

```bash
npm install react-simple-dropdown
```

### How to use

This module provides three React components that you can use as a basis for any kind of dropdown menu:

- `DropdownTrigger`: The element that will cause your dropdown to appear when clicked.
- `DropdownContent`: Contains the "filling" of your dropdown. Generally, this is a list of links.
- `Dropdown`: The base element for your dropdown. This contains both the `DropdownTrigger` and the `DropdownContent`, and handles communication between them.

There is also a [barebones stylesheet](styles/Dropdown.css) which **must be included in order for the component to actually work**.

Keep in mind that `DropdownTrigger` and `DropdownContent` **must be direct children** of `Dropdown`. Here's a quick example:

```js
var React = require('react');
var Dropdown = require('react-simple-dropdown');
var DropdownTrigger = Dropdown.DropdownTrigger;
var DropdownContent = Dropdown.DropdownContent;

var Menu = React.createClass({
    render: function () {
        return (
            <Dropdown>
                <DropdownTrigger>Profile</DropdownTrigger>
                <DropdownContent>
                    <img src="avatar.jpg" /> Username
                    <ul>
                        <li>
                            <a href="/profile">Profile</a>
                        </li>
                        <li>
                            <a href="/favorites">Favorites</a>
                        </li>
                        <li>
                            <a href="/logout">Log Out</a>
                        </li>
                    </ul>
                </DropdownContent>
            </Dropdown>
        )
    }
});
```

### Options

Options can be passed to `Dropdown` as props. A list of available options can be found below. These must be passed to the containing `Dropdown` component.

Property | Type | Description
----- | ----- | -----
**active** | *boolean* | Manually show/hide the `DropdownContent`. Make sure to unset this or the dropdown will stay open.
**disabled** | *boolean* | Disable toggling of the dropdown by clicking on `DropdownTrigger`. Toggling with `active`, `show()`, and `hide()` is still possible.
**removeElement** | *boolean* | Remove the `DropdownContent` element when inactive (rather than just hide it).
**onShow** | *function* | Callback for when `DropdownContent` is shown.
**onHide** | *function* | Callback for when `DropdownContent` is hidden.


### Instance

Each instance of `Dropdown` has some methods developers might find useful.

Method | Description
----- | -----
**show** | Shows the dropdown.
**hide** | Hides the dropdown.
**isActive** | Returns a boolean indicating whether or not the dropdown is active.

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