Closed Ok9xNirab closed 1 year ago
You can pass a list of custom items to the Combobox (see example here), you just need to provide an itemToString
function (which provides the label). The onChange
handler will return the whole item, though, so you'd need to do something like...
<Combobox
initialSelectedItem={{ label: 'Banana' }}
items={[{ label: 'Banana', id: 1 }, { label: 'Pear', id: 2 }, { label: 'Kiwi', id: 3 }]}
itemToString={item => (item ? item.label : '')}
onChange={selected => console.log(selected.id)}
/>
Thanks !
Basic combobox example:
I want to pass items something like :
When select any of this item , then it should return only value via
onChange
event.Is it possible now ?? I didn't find anything in Documentation !!