<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-5HGSQD2L" height="0" width="0" style="display:none;visibility:hidden" title="GTM"></iframe>

Combobox

Input field that combines a text input and a list of suggested values that appear when the user enters text into the text input.
styleKeys: popoverstyleKeys: listbox

Use Combobox...

  • To enable users to either pick a predefined value from a list or input their own.
  • As our default Search Input with options.
  • When you have a list of 15 or more options that you want to be searchable.

Don't use Combobox...

  • When you want to restrict input exclusively to a limited list of less than 15 options. Use a Dropdown or a Listbox instead.

Basic Combobox

A BasicCombobox is a simple-to-use convenience component that handles most typical use cases of a Combobox.

It takes a set of ComboboxOption components as children:

  • Each ComboboxOption must have a unique key prop holding that option's value.
  • The child contents of the ComboboxOption will be displayed in the popover of suggestions once the user starts typing.
  • Any ComboboxOption that contains more than basic text (such as a Callout, thumbnail, or custom JSX) must have a textValue prop. This is required for Accessibility
  • Any ComboboxOption that contains more than basic text (such as a Callout, thumbnail, or custom JSX) must have a textValue prop. This is required for accessibility and is also the value that is displayed in the text input on selection..

Any ComboboxOption that contain more than basic text (such as a Callout, thumbnail, or custom JSX) must have a textValue prop. This is required for accessibility and is also the value that is displayed in the text input on selection.

The preview has been updated.

Full Combobox

A Full Combobox allows you to put additional content inside the ComboboxPopover sub-component, notably a ComboboxPopoverTitle above the ComboboxList.

The preview has been updated.

With thumbnail container

Use ComboboxOptionThumbnailContainer, which contains a square FluidImage, to display square thumbnail images in selections.

The preview has been updated.

With floating label

Use ComboboxWithFloatingLabel to move the label inside the input above the selection. This creates visual harmony with other form elements like text inputs that support floating labels. Keep label text short or use the fullWidth prop to maximize width.

The preview has been updated.

With Search Input

Use ComboboxWithSearchInput to transform a Combobox in our default search field.

Refer to Search Input guidelines

The preview has been updated.

Allow custom value

Use allowsCustomValue when you want to allow users to enter custom text in a Combobox, even if the entered text does not match any of the predefined options.

The preview has been updated.

Managing state

Add the disableAutoFilter prop to the Combobox when you also want to control the list of filtered options.

The preview has been updated.

Dynamic collections

Use the dynamic collections API for optimal performance with large or dynamic data. Pass an array into the items prop of the Combobox and a render function as the child of ComboboxList.

The useAsyncList hook can be used when dealing with async data in order to fetch remote data (this is optional). Alternatively, you can manage async data similarly as in the controlled Combobox example above. Refer to the React-Area documentation for useAsyncList.

Share

Placement

The Combobox prioritizes usability through generous padding and a large font.

  • Ensure the Combobox has sufficient room for rendering on the page.
  • Account for the possibility of translated text being longer than English text to prevent display issues.

Props

BasicCombobox
This component is implemented using the <div /> as the root element. You can utilize the native attributes supported by <div /> tag. The ref is directly assigned to the root element, allowing you to access and manipulate it as needed.
See core props for additional props that can be applied to this component.
proptyperequireddescriptiondefault
aria-labelstringfalse
Defines a string value that labels the current element. Label for accessibility @see aria-labelledby.
null
aria-labelledbystringfalse
Identifies the element (or elements) that labels the current element. Label for accessibility @see aria-describedby.
null
childrenReactNodefalse
The content to be displayed within the popover.
null
itemsIterable<any>false
Optional collection of dynamic options. Use with a render function as a child of ListboxList
null
onSelectionChange((key: string | number) => void)false
Callback trigger on selection change
null
selectedKeystring | numberfalse
Specify the selected key
null
disabledKeysSet<string | number>false
Specify the array of keys that should be disabled
null
inputValuestringfalse
Specify the input value
null
defaultInputValuestringfalse
Default input value
null
onInputChange((value: string) => void)false
Callback function that triggers on input change
null
disableAutoFilterbooleanfalse
Whether the auto filtering should be enable or disabled
null
allowsCustomValuebooleanfalse
Allows a custom input value that doesn't match an option in the list This also prevents the input text from clearing when the input loses focus
null
allowEmptyCollectionbooleanfalse
Allows the popover to open even there are no items present. Useful when fetching data asynchronously or to display a loading or empty state
null
size"standard" | "mini" | nullfalse
⚠️ Deprecated - This is deprecated without a replacement.
The size variation Available options: 'standard', 'mini',
null
skin"standard" | "error" | nullfalse
The visual variant. Note that error is implied if the TextInput is used inside of a FormInput that also contains a FormError. Available options: 'standard', 'error'
standard
placementPlacementfalse
The placement of the popover. eg: "bottom start", "top end", "top", "bottom"
bottom start
offsetnumberfalse
The offset distance from the trigger element.
null
isNonModalbooleanfalse
Specifies whether the popover is used in a non-modal context.
null
hideArrowbooleanfalse
Specifies whether to hide the arrow of the popover.
true
fullBleedbooleanfalse
Specifies whether the popover should take up the full available width.
null
labelTextstringfalse
The label text for accessibility.
null
portalContainerElementfalse
The container for the portal where the popover is rendered.
null
inModalboolean | nullfalse
Set to "true" if the Listbox Popover is rendering inside a Modal.
null
Combobox
This component is implemented using the <div /> as the root element. You can utilize the native attributes supported by <div /> tag. The ref is directly assigned to the root element, allowing you to access and manipulate it as needed.
See core props for additional props that can be applied to this component.
proptyperequireddescriptiondefault
aria-labelstringfalse
Defines a string value that labels the current element. Label for accessibility @see aria-labelledby.
null
aria-labelledbystringfalse
Identifies the element (or elements) that labels the current element. Label for accessibility @see aria-describedby.
null
itemsIterable<any>false
Optional collection of dynamic options. Use with a render function as a child of ListboxList
null
onSelectionChange((key: string | number) => void)false
Callback trigger on selection change
null
selectedKeystring | numberfalse
Specify the selected key
null
disabledKeysSet<string | number>false
Specify the array of keys that should be disabled
null
inputValuestringfalse
Specify the input value
null
defaultInputValuestringfalse
Default input value
null
onInputChange((value: string) => void)false
Callback function that triggers on input change
null
disableAutoFilterbooleanfalse
Whether the auto filtering should be enable or disabled
null
allowsCustomValuebooleanfalse
Allows a custom input value that doesn't match an option in the list This also prevents the input text from clearing when the input loses focus
null
allowEmptyCollectionbooleanfalse
Allows the popover to open even there are no items present. Useful when fetching data asynchronously or to display a loading or empty state
null
ComboboxInput
This component is implemented using the <input /> as the root element. You can utilize the native attributes supported by <input /> tag. The ref is directly assigned to the root element, allowing you to access and manipulate it as needed.
See core props for additional props that can be applied to this component.
proptyperequireddescriptiondefault
size"standard" | "mini" | nullfalse
⚠️ Deprecated - This is deprecated without a replacement.
The size variation Available options: 'standard', 'mini',
null
skin"standard" | "error" | nullfalse
The visual variant. Note that error is implied if the TextInput is used inside of a FormInput that also contains a FormError. Available options: 'standard', 'error'
standard
ComboboxList
This component is implemented using the <ul /> as the root element. You can utilize the native attributes supported by <ul /> tag. The ref is directly assigned to the root element, allowing you to access and manipulate it as needed.
See core props for additional props that can be applied to this component.
ComboboxOption
This component is implemented using the <li /> as the root element. You can utilize the native attributes supported by <li /> tag. The ref is directly assigned to the root element, allowing you to access and manipulate it as needed.
See core props for additional props that can be applied to this component.
proptyperequireddescriptiondefault
labelReactNodeLikefalse
The contents to render inside the ListboxButton. Can include JSX
null
disabledboolean | nullfalse
Whether or not the option is disabled.
null
textValuestring | nullfalse
The option's human-readable string. Required if using JSX inside of an option
null
withThumbnailboolean | nullfalse
Whether or not the option has a thumbnail.
null
ComboboxPopover
This component is implemented using the <div /> as the root element. You can utilize the native attributes supported by <div /> tag. The ref is directly assigned to the root element, allowing you to access and manipulate it as needed.
See core props for additional props that can be applied to this component.
proptyperequireddescriptiondefault
childrenReactNodefalse
The content to be displayed within the popover.
null
placementPlacementfalse
The placement of the popover. eg: "bottom start", "top end", "top", "bottom"
bottom start
offsetnumberfalse
The offset distance from the trigger element.
null
isNonModalbooleanfalse
Specifies whether the popover is used in a non-modal context.
null
hideArrowbooleanfalse
Specifies whether to hide the arrow of the popover.
true
fullBleedbooleanfalse
Specifies whether the popover should take up the full available width.
null
labelTextstringfalse
The label text for accessibility.
null
portalContainerElementfalse
The container for the portal where the popover is rendered.
null
inModalboolean | nullfalse
Set to "true" if the Listbox Popover is rendering inside a Modal.
null
ComboboxPopoverTitle
This component is implemented using the <h4 /> as the root element. You can utilize the native attributes supported by <h4 /> tag. The ref is directly assigned to the root element, allowing you to access and manipulate it as needed.
See core props for additional props that can be applied to this component.
ComboboxOptionTextContainer
This component is implemented using the <div /> as the root element. You can utilize the native attributes supported by <div /> tag. The ref is directly assigned to the root element, allowing you to access and manipulate it as needed.
See core props for additional props that can be applied to this component.
ComboboxOptionThumbnailContainer
This component is implemented using the <div /> as the root element. You can utilize the native attributes supported by <div /> tag. The ref is directly assigned to the root element, allowing you to access and manipulate it as needed.
See core props for additional props that can be applied to this component.

Related

Was this page useful?

Thanks for your feedback!

Feel free to include your name if you wish to have a follow up conversation.


search
Published: Jan 31, 2022Last updated: Oct 17, 2024