Igloo branding

Combobox

A combobox has all the features a select does as well as filtering and clearing results.

Installation

To install @igloo-ui/combobox in your project, you will need to run the following command using npm:

npm install @igloo-ui/combobox

If you prefer Yarn, use the following command instead:

yarn add @igloo-ui/combobox

Usage

Then to use the component in your code just import it!

import Combobox from '@igloo-ui/combobox';

const optionList = [
  {
    label: 'Text 1',
    value: '1',
  },
  {
    label: 'Text 2 (disabled)',
    value: '2',
    disabled: true,
  },
  {
    label:
      'Text 3. I will put a lot of text here to see how it behaves. Hopefully it looks good!',
    value: '3',
    color: '#74DCC9',
  },
];

<Combobox options={optionList} search clear clearTooltipText="Remove Mapping">
  Place holder text
</Combobox>;

API

Combobox

PropTypeDescription
autoWidthbooleanSet this to true and the dropdown will take the width of its content, not the width of the select
childrenReactNodeDefault value displayed in the Select
classNamestringAdd a specific class to the Select
clearbooleanIf true, it clears any selected option
clearTooltipTextstringThe tooltip text for the clear button
closeOnSelectbooleanWhether or not the combobox should close after an item is selected
dataTeststringAdd a data-test tag for automated tests
disabledbooleanDisable the Select so the user cannot click on it
errorbooleanThe Select is in an error state
footerReactNodeThe footer content of the combobox
isCompactbooleanTrue for a compact appearance
isOpenbooleanTrue if the option list is displayed
listSizeComboboxListSizeSize of the list
loadingbooleanWhether or not the list is loading
multiplebooleanThe Combobox gains checkboxes beside each option to be able to select multiple options
noResultsTextstringSpecify the text to display when there are no results found
onAfterClose() => voidCallback when the dropdown is closed and animations are done
onChange(option: OptionType) => voidCallback when selected content changes
onClear() => voidCallback called when selected is cleared
onClose() => voidCallback when the dropdown is closed
onInput(value: string) => voidCallback when the user types in the search box
onOpen() => voidCallback when the dropdown is opened
onScrollEnd() => voidCallback when the user scrolls to the end of the dropdown
optionsComboboxOption[]List of available options.
scrollEndThresholdnumberThe threshold in pixels from the bottom of the dropdown to trigger the onScrollEnd callback
searchbooleanWhether or not to display a search box when open
selectedOptionOptionType | OptionType[]The initial selected option or a list of selected options
showSearchIconbooleanWhether or not to display the search icon

ComboboxInput

PropTypeDescription
clearbooleanIf true, it clears any selected option
clearTooltipTextstringThe tooltip text for the clear button
colorstringAdd a colored square instead of an image or an icon
disabledbooleanIf the combobox is disabled
iconReactElement<any, string | JSXElementConstructor<any>>Add an icon to the left of the option
isOpenbooleanTrue if the option list is displayed
isPlaceholderbooleanTrue if the value is a placeholder
labelReactNodeOption title.
onClear() => voidCallback for when the clear button is clicked
onSearch(value: string) => voidCallback to execute on input of the searchbox
searchbooleanWhether or not to display a search box when open
searchRefRefObject<HTMLInputElement>The ref for the search field
showSearchIconbooleanWhether or not to display the search icon
srcstringSpecifies the url for the image to show
valuestringThe value of the input