Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Material design search bar

License

NotificationsYou must be signed in to change notification settings

TeamWertarbyte/material-ui-search-bar

Repository files navigation

Example

See this component inaction

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 usingnpm i --save material-ui-search-bar@beta

Usage

TheSearchBar is acontrolled input, meaning thatyou 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.

importSearchBarfrom"material-ui-search-bar";// *snip*return(<SearchBarvalue={this.state.value}onChange={(newValue)=>this.setState({value:newValue})}onRequestSearch={()=>doSomethingWith(this.state.value)}/>);

SearchBar Properties

NameTypeDefaultDescription
cancelOnEscapeboolWhether to clear search on escape
classes*objectOverride or extend the styles applied to the component.
classNamestring''Custom top-level class
closeIconnode<ClearIcon style={{ color: grey[500] }} />Override the close icon.
disabledboolfalseDisables text field.
onCancelSearchfuncFired when the search is cancelled.
onChangefuncFired when the text value changes.
onRequestSearchfuncFired when the search icon is clicked.
placeholderstring'Search'Sets placeholder text for the embedded text field.
searchIconnode<SearchIcon style={{ color: grey[500] }} />Override the search icon.
styleobjectnullOverride the inline-styles of the root element.
valuestring''The value of the text field.

* required property

Any other properties supplied will be spread to the underlyingInput component.

License

The files included in this repository are licensed under the MIT license.


[8]ページ先頭

©2009-2025 Movatter.jp