react-live-search

1.0.2 • Public • Published

react-live-search

Install

npm install --save react-live-search

Usage

import React, { Component } from 'react'
 
import ReactLiveSearch from 'react-live-search'
 
class Example extends Component {
  state = {
    value: '',
    data: [
      { label: 'test', value: 1 },
      { label: 'work', value: 2 },
      { label: 'great', value: 3 },
      { label: 'bar', value: 4 },
      { label: 'foo', value: 5 }
    ]
  };
  
  onChange = value => {
    this.setState({
      value
    });
  };
  
  onSelect = v => {};
 
 
  render () {
    return (
      <ReactLiveSearch
                value={value}
                onChange={this.onChange}
                onSelect={this.onSelect}
                data={data}
              />
    )
  }
}
Props Required/optional Description Type
value Required Search term String
data Required Data for search (should be an array of objects with label, value properties) Array
onChange Optional Handle input change Function
onSelect Optional Handle input data selection Function
itemStyle Optional Item styles Object

License

MIT © codeep team

Package Sidebar

Install

npm i react-live-search

Weekly Downloads

32

Version

1.0.2

License

MIT

Unpacked Size

5.89 MB

Total Files

6

Last publish

Collaborators

  • codeep-devs