项目
在 GitHub 查看
TeamWertarbyte/material-ui-search-bar
关于
Material Design 风格的搜索栏
网站与应用开发实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文Material Search Bar

See this component in action
Installation
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.
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 component.
License
The files included in this repository are licensed under the MIT license.
探索相关项目
加载中…