Code Monkey home page Code Monkey logo

material-ui-search-bar's Introduction

Material Search Bar

Example

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.

material-ui-search-bar's People

Contributors

alex-hudenko avatar alexbrazier avatar batazor avatar benamatare avatar benlinton avatar bernalrs avatar dekhanov avatar eavichay avatar frodestorhaug avatar gvso avatar lemaik avatar matsu911 avatar recurrence avatar revmischa avatar saschb2b avatar slenrow avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.