# search-bar-component

> search bar with autosuggest

Latest version **2.0.5** (published 2016-05-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install search-bar-component
pnpm add search-bar-component
yarn add search-bar-component
bun add search-bar-component
```

## 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 | 2.0.5 |
| Published | 2016-05-31 |
| First published | 2016-05-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | jameswomack |
| Maintainers | jameswomack |
| Keywords | search, autosuggest, autocomplete, react, react-component |

## Links

- npm: https://www.npmjs.com/package/search-bar-component
- Repository: https://github.com/jameswomack/search-bar-component
- Issues: https://github.com/jameswomack/search-bar-component/issues
- npm.io page: https://npm.io/package/search-bar-component

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

- 2.0.5 (latest) — 2016-05-31
- 2.0.4 — 2016-05-28
- 2.0.3 — 2016-05-28
- 2.0.2 — 2016-05-28
- 2.0.1 — 2016-05-28
- 2.0.0 — 2016-05-28
- 1.1.6 — 2016-05-28
- 1.1.5 — 2016-05-28

## README

# search-bar-component

A search bar component with Google-like autosuggest, built in React.

![search bar](http://s3.io/aU1rkdpjjSajYDvv8Xlv069w.gif)

## Installation

```
npm i search-bar-component -SE
```

## Demo

View the [demo online](https://jameswomack.github.io/search-bar-component).

Alternatively, run it locally:

```
npm install
npm run demo
```

Then visit [localhost:5000](http://localhost:5000).

## Usage

```js
<SearchBar
  onChange={(searchTerm, resolve) => {
    // get suggestions asynchronously based on `searchTerm`,
    // then pass them to `resolve()` to populate suggestions
  }}
  onSearch={(searchTerm) => {
    // do something on search
  }} />
```

## Props

### autoFocus

type: `boolean`

indicates whether the component should take focus on
page load

### delay

type: `number`

the number of milliseconds to wait after the last key
stroke before performing autosuggest

### inputName

type: `string`

sets the `name` attribute on the input field

### onChange

type: `function`

callback that executes on input and populates suggestions

### onSearch

type: `function`

callback that executes on search, triggered either by selecting a suggestion
or clicking the submit button

### placeholder

type: `string`

sets the `placeholder` attribute on the input field

### createSearchTermSuggestionMarkup

type: `function`

Determines how the relationship between a searchTerm and suggestion is represented in the DOM

## License

MIT

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