# use-typeahead

> ### A headless, lightweight typeahead library built on React Hooks.

Latest version **1.0.0** (published 2020-09-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install use-typeahead
pnpm add use-typeahead
yarn add use-typeahead
bun add use-typeahead
```

## Health

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

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

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2020-09-22 |
| First published | 2020-09-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 16.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Nathan Cook |
| Maintainers | cooknc416 |
| Keywords | react, typeahead, search, usetypeahead |

## Links

- npm: https://www.npmjs.com/package/use-typeahead
- Repository: https://github.com/cooknc416/use-typeahead
- npm.io page: https://npm.io/package/use-typeahead

## 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.0 (latest) — 2020-09-22

## README

# useTypeahead
### A headless, lightweight typeahead library built on React Hooks.

[![Codecov Coverage](https://img.shields.io/codecov/c/github/cooknc416/use-typeahead/develop.svg?style=flat-square)](https://codecov.io/gh/cooknc416/use-typeahead/) [![Pipeline Status](https://img.shields.io/github/workflow/status/cooknc416/use-typeahead/CI?style=flat-square)](https://github.com/cooknc416/use-typeahead/actions?query=workflow%3ACI)

## Features

- Single hook implementation
- Built with TypeScript
- ~1.5Kb minified, no dependencies
- Simple API, just provide a dataset and an optional configuration
- No styles provided, which means no overriding styles you don't like
- [WAI-ARIA](https://www.w3.org/TR/wai-aria/) compliant

## Example

``` jsx
export const Typeahead = (props: TypeaheadProps) => {
  const options = ['inscription', 'cacas', 'shelterers', 'dissimilitude', 'rustier', 'chervils', 'impossibly', 'ibuprofens', 'forechecker', 'misconceiving'];
  const {
    wrapperProps,
    inputProps,
    inputRef,
    menuProps,
    menuItems,
  } = useTypeahead(options);

  return (
    <div {...wrapperProps}>
      <input
        ref={inputRef}
        {...inputProps}
      />
      <div {...menuProps}>
        {menuItems.map((opt) => <div {...opt.props}>{opt.value}</div>)}
      </div>
    </div>
  );
};
```

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