Combobox

Combobox presents user with a set of options and allows to select one of them.

#

#

Combobox should be disabled, when user shouldn't be allowed to interact with it.

Individual options can be disabled too.

You can also provide a custom message when an option is disabled:

#

Mark combobox as loading, when options are fetched on the fly and are not yet available.

#

Invalid combobox indicates that current value isn't what the system expects.

#

Clearable combobox should be used when empty selection is acceptable.

#

Options can display an additional descriptive text underneath the label.

#

Options can display additional accessories view before and after the label. You can show an image using an image accessory. This is useful for showing logos when selecting sources or destinations, for example.

Additionally, using the showPlaceholderIcon prop will render a dotted circle in the placeholder state.

Icons can be accessories too.

Accessories can be shown on the left or right.

The combobox supports filtering options based on the input value. This state is accessible via the onSearchUpdate prop. Any change that's typed in the input will call this function.

#

Set renderInputInControl to false to render the combobox input inside of the popover.

#

You can disable sorting and filtering internally by setting disableSortingAndFiltering to true. This could be helpful if the options are already sorted and filtered externally.

#

Combobox allows user to create a new option on the fly, when no suitable option exists. For that, enable supportsCreatableOptions and set an onCreateOption function that will handle creation of options. Options can be created asynchronously, but you need to handle loading state yourself via isLoading prop.

#

You don't have to create objects with label and value keys as shown in the examples above. Combobox supports any objects, as long as you provide a label and value for each option via optionLabel and optionValue functions. description may be replaced with the optionDescription function.

#

There's a version of Combobox called GroupedCombobox, that supports groups of options.

#

Use the heavy variant to emphasize the combobox when in views with many selects or in-line with text.

#

Use the alternative variant to deemphasize the combobox when there are many selects.

#

The size prop impacts font-size and height. Default is set to md.

To set the width, use the width prop instead.

#

When rendering smaller-width comboboxes, you may end up with options that are quite tall. To make the options easier to read, pass in a specific width for the popover using popoverWidth.

It is recommended to match widths, when possible.

Show a header section within the combobox when the options are displayed.

#

#

  • When single selection is required.
  • When user should be able to create new options, if needed.
  • When selecting from user-generated data, where searching might come handy for long lists.

#

  • Use sentence case.

#

#

NameDefaultDescription

#

NameDefaultDescription

On this page