fmoo / react-typeahead

Pure react-based typeahead and typeahead-tokenizer
ISC License
677 stars 229 forks source link

change TypeaheadOption children property to React.PropTypes.node #222

Open digital-flowers opened 8 years ago

digital-flowers commented 8 years ago

from react documentation
React.PropTypes.node: Anything that can be rendered: numbers, strings, elements or an array (or fragment) containing these types.

this gives more flexibility to render custom html for each element for example

var searchTemplate = function(option){
     return <div><img src={option.image} /><span>{option.name}</span></div>
}

<TypeAhead 
options={searchData} 
filterOption='title' 
displayOption={searchTemplate} 
placeholder="Search.." 
maxVisible={6}/>