docs/documentation/components/combobox.mdx
The Combobox component is similar to a Select or SelectMenu component. Clicking the button will show all items. Typing in the text input will filter the list.
<Combobox
items={['Banana', 'Orange', 'Apple', 'Mango']}
onChange={selected => console.log(selected)}
placeholder="Fruit"
autocompleteProps={{
// Used for the title in the autocomplete.
title: 'Fruit'
}}
/>
<Combobox
openOnFocus
items={['Banana', 'Orange', 'Apple', 'Mango']}
onChange={selected => console.log(selected)}
placeholder="Fruit"
/>
<Combobox
openOnFocus
width="100%"
height={40}
items={['Banana', 'Orange', 'Apple', 'Mango']}
onChange={selected => console.log(selected)}
placeholder="Fruit"
/>
<Combobox
initialSelectedItem={{ label: 'Banana' }}
items={[{ label: 'Banana' }, { label: 'Pear' }, { label: 'Kiwi' }]}
itemToString={item => (item ? item.label : '')}
onChange={selected => console.log(selected)}
/>