ldx-widgets
Version:
widgets
97 lines (70 loc) • 2.06 kB
Markdown
[<< Component Index](../README.md)
# [InputTypeAhead](https://github.com/tmfi/ldx-web-utilities/blob/develop/src/components/input_type_ahead.coffee)
### results
**`Array`**
_Required_
Array of items that are printed in the results list
### value
**`String | Number`**
_Required_
Value of input field
### searchInterval
**`Number`**
_Optional_
Number in milliseconds before firing onSearch, after user finishes typing
### onChange
**`Function`**
_Required_
Function that is fired when the value of the input changes
### onSearch
**`Function`**
_Required_
Function that is fired when the timer triggers after the set searchInterval
### className
**`String`**
_Optional_
CSS class applied to form wrapper
### placeholder
**`String | Number`**
_Optional_
Default placeholder value of text input
### resultConfig
**`Object`**
_Required_
component: React component that's rendered for each result item
height: Height for each result item - should be evenly divisible into maxContainerHeight
onResultSelect: Function that is fired when a list item is selected - should be used to alter state and pass new values to 'value' prop. This passes the result object and close method callback
### maxContainerHeight
**`Number | String`**
_Optional_
The maximum height of the typeahead results container. The resultConfig.height property should be evenly divisible into maxContainerHeight
### validation
**`Function`**
_Optional_
a method that takes the value and returns an arry of validation objects
always return an empty array for a valid value
see the validation store for more documentation on validation objects
### zIndex
**`Number`**
_Optional_
Default style is 10. Optionally pass higher number to cover typeaheads on the same page.
### disabled
**`Boolean`**
_Optional_
### clearInput
**`Function`**
_Optional_
a method that will clear out the input
if passed display the clear btn in the input field