Use ComboboxField when someone needs to search for or choose one option from a list. It combines
an input, label, description, validation message, popover, and listbox.
Use defaultItems for a static collection. Use items with loadingState when results load or
filter asynchronously. ComboboxField supports one selected value.
Pass static children or a render function to create options. @luke-ui/react/combobox-field exports
ComboboxItem and ComboboxSection alongside the field. The listbox marks the selected option.
When there is a selection, the field shows a clear button before the trigger. The clear button
removes the selection and input text. The clear button is unavailable for disabled and read-only
fields.
Set isRequired to make a selection mandatory. Use necessityIndicator to choose how it appears
beside the label. Read Required fields for the indicator values.
Set isRequired or pass validate to check the selected value. ComboboxField shows its
validation message after validation fails. Pass errorMessage only for an error you already have,
such as one from a form library or your server. A non-empty message marks the field invalid. Read
Validation for where messages come from, server errors, and how to write them.
Use size to set the control height and typography. Use small in compact layouts. medium is the
default. On touch devices, small uses the body text size so iOS Safari doesn't zoom into the field
on focus.
Pass items and loadingState when results load or filter asynchronously. If the list is empty
while it loads or filters, the field shows a loading indicator. An empty completed result shows “No
results”.
Pass onLoadMore for incremental results. It adds the built-in load-more row and spinner. Use
loadMoreItem when that row needs custom content. listBoxProps configures the underlying listbox.
popoverProps and menuWidth configure the desktop popover, which mobile replaces with a tray.
ComboboxField checks the device screen width, not the browser viewport width. Narrowing a desktop
browser window does not switch to the tray.
Below the bp640 breakpoint, the field shows a button that displays the selected option. Someone
taps the button to open a modal tray with a focused search input. The tray has a fixed height and
locks page scroll. With a reduced-motion preference, the tray fades in without sliding.
ComboboxFieldProps also accepts compatible DOM and ARIA attributes and event handlers for its rendered element.
Name
Type
Default
allowsCustomValue
boolean
Default: —
Whether the ComboBox allows a non-item matching input value to be set.
allowsEmptyCollection
boolean | undefined
Default: true
Whether the menu can stay open when filtering leaves no items. Tray search and empty states
need this so typing text that matches nothing does not dismiss the overlay.
The filter function used to determine if an option should be included in the combo box list.
By default, a language-sensitive "contains" filter from useFilter is used.
defaultInputValue
string
Default: —
The default value of the ComboBox input (uncontrolled).
defaultItems
Iterable<T>
Default: —
The list of ComboBox items (uncontrolled).
description
ReactNode
Default: —
Optional helper text shown below the control.
disabledKeys
Iterable<Key>
Default: —
The item keys that are disabled. These items cannot be selected, focused, or otherwise
interacted with.
errorMessage
ReactNode
Default: —
Validation message for a controlled error. A non-empty message marks the field invalid.
formValue
'text' | 'key'
Default: 'key'
Whether the text or key of the selected item is submitted as part of an HTML form. When
allowsCustomValue is true, this option does not apply and the text is always submitted.
inputId
string | undefined
Default: —
Element id for the input. The field generates one when omitted.
inputRef
Ref<HTMLInputElement>
Default: —
Targets the persistent combobox input on desktop. On mobile it targets the tray search input
only while the tray is open, so it is null when the tray is closed. Use ref for the root
element.
inputValue
string
Default: —
The value of the ComboBox input (controlled).
items
Iterable<T>
Default: —
The list of ComboBox items (controlled).
label
Exclude<ReactNode, boolean| null| undefined>
Default: —
Visible label. Pass non-empty, textual, non-interactive content. Place links and buttons
outside it, and associate external label content with aria-labelledby instead.