https://github.com/codeep/react-live-search
https://github.com/codeep/react-live-search
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/codeep/react-live-search
- Owner: codeep
- Created: 2018-12-19T18:00:20.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-04-22T14:09:27.000Z (over 6 years ago)
- Last Synced: 2025-09-01T22:34:02.962Z (5 months ago)
- Language: JavaScript
- Size: 579 KB
- Stars: 8
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# react-live-search
## Install
```bash
npm install --save react-live-search
```
## Usage
```jsx
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 (
)
}
}
```
| 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](https://github.com/codeep)