Interactive React UI component to show the auto-suggestion on the input based on the user's input in textbox based on provided data for suggestions. Demo - https://stackblitz.com/edit/react-b7kncf?file=src/App.js
Usage (Demo - https://stackblitz.com/edit/react-b7kncf?file=src/App.js)
import InputSuggestion from 'inputbox-suggestion/dist';
....
data =["measure", "message", "machine"]
....
getCurrentVal = (curr) => this.setState({val : curr})
....
setValue = (inputVal) => this.setState({text : inputVal})
...
<InputSuggestion inputBoxValue={this.setValue} suggestions={data} />
...
<InputSuggestion currentInputBoxValue={this.getCurrentVal} inputBoxValue={this.setValue}
suggestionsStyle={{padding:'5%',borderBottom:'0.5px solid'}}
suggestions={data} />
prop name | functionality | required/optional |
---|---|---|
suggestions | Data in form of Array to show suggestion for input | *required |
inputBoxValue | Return selected value of input box | optional |
currentInputBoxValue | Return the current value of input box | optional |
suggestionsStyle | Styles for suggestions | optional |
npm i inputbox-suggestion
Mohit Kapoor -@2cool2envy - kapoormohit01@gmail.com
eMail : kapoormohit01@gmail.com