# @mmussadiq/react-search-bar

> Material style search bar

Latest version **2.0.0** (published 2021-12-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install @mmussadiq/react-search-bar
pnpm add @mmussadiq/react-search-bar
yarn add @mmussadiq/react-search-bar
bun add @mmussadiq/react-search-bar
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2021-12-18 |
| First published | 2021-12-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 84 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 260 |
| Author | Wertarbyte |
| Maintainers | mmussadiq |
| Keywords | react, material, material-design, material-ui, search, react-component |

## Links

- npm: https://www.npmjs.com/package/@mmussadiq/react-search-bar
- Repository: https://github.com/TeamWertarbyte/material-ui-search-bar
- Homepage: https://github.com/TeamWertarbyte/material-ui-search-bar#readme
- Issues: https://github.com/TeamWertarbyte/material-ui-search-bar/issues
- npm.io page: https://npm.io/package/@mmussadiq/react-search-bar

## Dependencies (2)

- [classnames](https://npm.io/package/classnames.md) ^2.2.5
- [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

- 2.0.0 (latest) — 2021-12-18
- 1.0.0 — 2021-12-18

## README

# Material Search Bar

![Example](demo.gif)

See this component in [action](https://teamwertarbyte.github.io/material-ui-search-bar/)

## Installation

```shell
npm i --save material-ui-search-bar
```

Note: If you're still using Material-UI v3, please install v0.x of the search bar using `npm i --save material-ui-search-bar@beta`

## Usage

The `SearchBar` is a _controlled input_, meaning that _you_ need to keep the input state. This allows for much flexibility, e.g. you can change and clear the search input just by changing its props.

```js
import SearchBar from "material-ui-search-bar";
// *snip*

return (
  <SearchBar
    value={this.state.value}
    onChange={(newValue) => this.setState({ value: newValue })}
    onRequestSearch={() => doSomethingWith(this.state.value)}
  />
);
```

### SearchBar Properties

| Name            | Type     | Default                                       | Description                                             |
| --------------- | -------- | --------------------------------------------- | ------------------------------------------------------- |
| cancelOnEscape  | `bool`   |                                               | Whether to clear search on escape                       |
| classes\*       | `object` |                                               | Override or extend the styles applied to the component. |
| className       | `string` | `''`                                          | Custom top-level class                                  |
| closeIcon       | `node`   | `<ClearIcon style={{ color: grey[500] }} />`  | Override the close icon.                                |
| disabled        | `bool`   | `false`                                       | Disables text field.                                    |
| onCancelSearch  | `func`   |                                               | Fired when the search is cancelled.                     |
| onChange        | `func`   |                                               | Fired when the text value changes.                      |
| onRequestSearch | `func`   |                                               | Fired when the search icon is clicked.                  |
| placeholder     | `string` | `'Search'`                                    | Sets placeholder text for the embedded text field.      |
| searchIcon      | `node`   | `<SearchIcon style={{ color: grey[500] }} />` | Override the search icon.                               |
| style           | `object` | `null`                                        | Override the inline-styles of the root element.         |
| value           | `string` | `''`                                          | The value of the text field.                            |

\* required property

Any other properties supplied will be spread to the underlying [`Input`](https://material-ui.com/api/input/#input) component.

## License

The files included in this repository are licensed under the MIT license.

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