0.0.3 • Published 6 years ago

@fiveem/react-autocomplete v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

React Autocomplete

npm (scoped)

React autocomplete that uses debounce. In order to select a value from the autocomplete, the arrow up/down keys and mouse can be used.

Screenshots

React Autocomplete

Install

npm i @fiveem/react-autocomplete

Usage

import Autocomplete from '@fiveem/react-autocomplete'

<Autocomplete   suggestions={this.state.suggestiona}
                inputValue={this.state.inputValue}
                debounceTime={this.state.debounceTime}
                onChange={this.onChange}
                containerStyle={this.state.containerStyle}
                inputStyle={this.state.inputStyle}
                autocompleteStyle={this.state.autocompleteStyle}
                suggestionStyle={this.state.suggestionStyle}
                selectedSuggestionStyle={this.state.selectedSuggestionStyle}/>

API

nametypesample valuedescription
suggestionsArray['Romania', 'Spain', 'Italy', 'Georgia']Suggestions that will be displayed inside the autocomplete
inputValueNumber/String20/'Spain'The value that will be displayed inside the input)
debounceTimeNumber1000When the user ends typing in the input, the onChange method will be called after debounceTime seconds (debounceTime should be specified in miliseconds). Default value is 500 ms.`
onChangeFunctionFunction that is called when the input value changes
containerStyleObjectStyle that will be applied on the container
inputStyleObjectStyle that will be applied on the input
autocompleteStyleObjectStyle that will be applied on the autocomplete container
suggestionStyleObjectStyle that will be applied on the suggestion (the list of items that is displayed inside the autocomplete container)
selectedSuggestionStyleObjectStyle that will be applied on the active/selected suggestion (on mouse hover or when the user uses the arrow up and arrow down keys)

License

react-autocomplete is released under the MIT license.