# react-autocomplete-option

> A module for auto completing options in react

Latest version **1.0.1** (published 2022-09-28) · ISC license · 0 weekly downloads

## Install

```sh
npm install react-autocomplete-option
pnpm add react-autocomplete-option
yarn add react-autocomplete-option
bun add react-autocomplete-option
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2022-09-28 |
| First published | 2022-09-27 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 13.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | David Okeke |
| Maintainers | iamdavidokeke |
| Keywords | React, options, javascript |

## Links

- npm: https://www.npmjs.com/package/react-autocomplete-option
- Repository: https://github.com/IamDavidOkeke/AutocompleteOption
- Homepage: https://github.com/IamDavidOkeke/AutocompleteOption#readme
- Issues: https://github.com/IamDavidOkeke/AutocompleteOption/issues
- npm.io page: https://npm.io/package/react-autocomplete-option

## 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.0.1 (latest) — 2022-09-28
- 1.0.0 — 2022-09-27

## README

# AutocompleteOption
React- Auto complete option is a react component library for building better search components

## Usage
```
import React { useState } from 'react';
import Select from 'react-autocomplete-options';

function Selector() {
  const [inputValue, setInputValue] = useState('');


  const handleInput = (input) =>{
    setInputValue(input)
  }



  return (
    <>
      <h1>Search options</h1>

      <Select handleInput = {handleInput}
          <option>United States</option>
          <option>United Kingdom</ option>
          <option>Canada</option>
          <option>France</option>
      </Select>
    </>
  );
}

ReactDOM.render(<Selector />, document.getElementById('root'))

```

## Interface 
The react autocomplete option returns a component similar to the HTML select tag but with superpowers. Similar to the datalist tag. It has an input for searching the options. The options update whenever there is a change in input value rendering only the options that match the input value.

You can get the input value  a user selects by passing a `handleInput` function as a prop to the component. And in this function you decide what to do with your input value.
**Note:** It must be a `handleInput` function.

## Styling 
Adding customized styles is easy. There are three components of the selector: 
- input box
- options container or list
- options

Style each individually by passing classnames as props to the Select component.
```
    <Select 
        handleInput = {handleInput}
        placeholder: 'please search options',
        inputClassName: 'input',
        listClassName: 'list',
        optionsClassName: 'option',
        >
          <option>United States</option>
          <option>United Kingdom</ option>
          <option>Canada</option>
          <option>France</option>
    </Select>
```

You can also pass placeholder for the input box as props to your component

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