options | Array | [] | An array supplied to the filter function. |
maxVisible | Number | | Limit the number of options rendered in the results list. |
resultsTruncatedMessage | String | | If maxVisible is set, display this custom message at the bottom of the list of results when the result are truncated. |
name | String | | The name for HTML forms to be used for submitting the tokens' values array. |
customClasses | Object | | Allowed Keys: input results listItem listAnchor hover typeahead resultsTruncated token
An object containing custom class names for child elements. Useful for integrating with 3rd party UI kits. |
placeholder | String | | Placeholder text for the typeahead input. |
disabled | Boolean | | Set to true to add disable attribute in the <input> or <textarea> element. |
inputProps | Object | | Props to pass directly to the <input> element. |
onKeyDown | Function | | Event handler for the keyDown event on the typeahead input. |
onKeyPress | Function | | Event handler for the keyPress event on the typeahead input. |
onKeyUp | Function | | Event handler for the keyUp event on the typeahead input. |
onBlur | Function | | Event handler for the blur event on the typeahead input. |
onFocus | Function | | Event handler for the focus event on the typeahead input. |
defaultSelected | Array | | A set of values of tokens to be loaded on first render. |
onTokenRemove | Function | | `Event handler triggered whenever a token is removed. |
onTokenAdd | Function | | Event handler triggered whenever a token is added. Params: (addedToken) |
displayOption | String , Function | | - A function to map an option onto a string for display in the list. Receives
(option, index) where index is relative to the results list, not all the options. Can either return a string or a React component. - If provided as a string, it will interpret it as a field name and use that field from each option object.
|
filterOption | String , Function | | - A function to filter the provided
options based on the current input value. For each option, receives (inputValue, option) . If not supplied, defaults to fuzzy string matching. - If provided as a string, it will interpret it as a field name and use that field from each option object.
|
searchOptions | Function | | A function to filter, map, and/or sort the provided options based on the current input value. Receives (inputValue, options) . If not supplied, defaults to fuzzy string matching. Note: the function can be used to store other information besides the string in the internal state of the component. Make sure to use the displayOption , inputDisplayOption , and formInputOption props to extract/generate the correct format of data that each expects if you do this. |
inputDisplayOption | String , Function | | A function that maps the internal state of the visible options into the value stored in the text value field of the visible input when an option is selected. Receives (option) . If provided as a string, it will interpret it as a field name and use that field from each option object. If no value is set, the input will be set using displayOption when an option is selected. |
formInputOption | String or Function | | A function to map an option onto a string to include in HTML forms as a hidden field (see props.name ). Receives (option) as arguments. Must return a string.If specified as a string, it will interpret it as a field name and use that field from each option object. If not specified, it will fall back onto the semantics described in props.displayOption . |
defaultClassNames | boolean | true | If false, the default classNames are removed from the tokenizer and the typeahead. |
showOptionsWhenEmpty | boolean | false | If true, options will still be rendered when there is no value. |