Skip to content

Commit

Permalink
Update the readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
leMaik committed Aug 1, 2020
1 parent 946819d commit ef894f6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
41 changes: 21 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
# Material Search Bar
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
[![Build Status](https://travis-ci.org/TeamWertarbyte/material-ui-search-bar.svg?branch=master)](https://travis-ci.org/TeamWertarbyte/material-ui-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@beta
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'
import SearchBar from "material-ui-search-bar";
// *snip*

return (
Expand All @@ -25,25 +26,25 @@ return (
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.|

| 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

Expand Down
1 change: 0 additions & 1 deletion styleguide.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const { createConfig, babel } = require('webpack-blocks')
const path = require('path')

module.exports = {
skipComponentsWithoutExample: true,
Expand Down

0 comments on commit ef894f6

Please sign in to comment.