# react-free-dropdown

> Easy custom dropdown list with React

Latest version **1.1.1** (published 2020-03-14) · MIT license · 0 weekly downloads

## Install

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

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2020-03-14 |
| First published | 2020-02-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 189.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | flamingotiger |
| Maintainers | flamingotiger |
| Keywords | free, dropdown, custom, react.js, react |

## Links

- npm: https://www.npmjs.com/package/react-free-dropdown
- Repository: https://github.com/flamingotiger/react-free-dropdown
- Homepage: https://github.com/flamingotiger/react-free-dropdown#readme
- Issues: https://github.com/flamingotiger/react-free-dropdown/issues
- npm.io page: https://npm.io/package/react-free-dropdown

## Dependencies (5)

- [react](https://npm.io/package/react.md) ^16.12.0
- [styled-components](https://npm.io/package/styled-components.md) ^5.0.1
- [@testing-library/react](https://npm.io/package/@testing-library/react.md) ^9.4.0
- [@testing-library/jest-dom](https://npm.io/package/@testing-library/jest-dom.md) ^5.1.1
- [@testing-library/react-hooks](https://npm.io/package/@testing-library/react-hooks.md) ^3.2.1

## 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.1.1 (latest) — 2020-03-14
- 1.1.0 — 2020-02-20
- 1.0.15 — 2020-02-20
- 1.0.14 — 2020-02-20
- 1.0.13 — 2020-02-20
- 1.0.12 — 2020-02-20
- 1.0.10 — 2020-02-20
- 1.0.9 — 2020-02-19
- 1.0.8 — 2020-02-19
- 1.0.7 — 2020-02-17
- 1.0.6 — 2020-02-14
- 1.0.5 — 2020-02-14
- 1.0.4 — 2020-02-14
- 1.0.3 — 2020-02-13
- 1.0.2 — 2020-02-13
- … 2 more at https://npm.io/package/react-free-dropdown/versions

## README

<div align="center">
  <img src="./public/RFDD_logo.png" alt="react free fropdown logo" />
</div>
<h1 align="center">react-free-dropdown <small><sup>(RFDD)</sup></small></h1>
<div align="center">

**Easy custom** dropdown list with [`React`](https://facebook.github.io/react/)

[![Actions Status](https://github.com/flamingotiger/react-free-dropdown/workflows/react-free-dropdown-ci/badge.svg)](https://github.com/flamingotiger/react-free-dropdown/actions)
[![npm](https://img.shields.io/npm/v/react-free-dropdown.svg)](https://www.npmjs.com/package/react-free-dropdown)
[![install size](https://packagephobia.now.sh/badge?p=react-free-dropdown)](https://packagephobia.now.sh/result?p=react-free-dropdown)
[![npm downloads](https://img.shields.io/npm/dm/react-free-dropdown.svg?style=flat-square)](http://npm-stat.com/charts.html?package=react-free-dropdown)

</div>

## Get Started 📦
`react-free-dropdown` install the package.

```shell
npm install react-free-dropdown
```

## Usage 📃

```javascript jsx
import React from 'react';
import { Rfdd, RfddOption } from 'react-free-dropdown';

const App = () => {
  const [value, setValue] = React.useState('');
  return (<>
      <Rfdd onChange={optionValue => setValue(optionValue)}>
        <RfddOption value="Apple">Apple</RfddOption>
        <RfddOption value="Grape">Grape</RfddOption>    
      </Rfdd>
      <p>{value}</p>
    </>);
}

export default App;
```

## Rfdd Property ⛷

| Property  | Type | Descriptions | Example |
| ------------- | ------------- | ------------- | ------------- |
| selectClassName | `string` | select className | `selectClassName="select-classname"` |
| selectStyle  | `React.CSSProperties`  | select component style | `selectStyle={{border: '1px solid red'}}` | 
| optionClassName | `string` | option className | `optionClassName="option-classname"` |
| optionStyle | `string` | all option custom style | `optionStyle='border: 1px solid red;'` |
| style  | `React.CSSProperties`  | dropdown wrapper style | `style={{border: '1px solid red'}}` |
| className | `string` | dropdown wrapper className | `className="wrapper-classname"` |
| focusStyle  | `React.CSSProperties`  | if focus use style | `focusStyle={{border: '1px solid red'}}` | 
| value | `string` | selected value | `value={value}` |
| children | `React.ReactElement<RfddOptionType, 'RfddOption'>[]` | only use RfddOption component | `<RfddOption>option</RfddOption>`|
| onChange | `(value: string) => void` | change value function | `onChange={(optionValue) => setValue(optionValue)}`|
| mode | `light` or `dark` | light or dark mode | `mode='dark'`|
| hoverStyle | `string` | custom hover style | `hoverStyle='border: 1px solid red;'` |
| icon | `any` | usage import image `import image from './example.png'` | `icon={image}` |
| hiddenIcon | `boolean` | hidden icon | `hiddenIcon={true}` |
| placeholder | `string` | setting placeholder | `placeholder='area'` |
| listStyle | `string` | ul list style | `listStyle='max-height:200px'` |
| optionOnClick | `() => void` | all option onClick | `optionOnClick={() => console.log('onClick')}`|

## RfddOption Property 🏂

| Property  | Type | Descriptions | Example |
| ------------- | ------------- | ------------- | ------------- |
| value | `string` | option value | `value='option-value'`|
| style  | `React.CSSProperties`  | must be entered as camelcase | `style={{ border: '1px solid red' }}`|
| className  | `string`  | must be entered as camelcase | `className="class-name"`|
| children | `React.ReactNode` | option children | `option text or <div>option Element</div>`|
| hoverStyle | `string` | each option custom hover style | `hoverStyle='border: 1px solid red;'` |
| onClick | `() => void` | onChange before active function | `onClick={() => console.log('onClick')}` |

## Preview 🎆

![react-free-dropdown preview](./public/react-free-dropdown-example.gif)

🔎[Play the example](https://react-free-dropdown.netlify.com/?path=/story/drop-down-basic--light-mode)

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