The autocomplete is a text input enhanced by a list of suggested options. This component is useful when the user has to choose a single option from a predefined list.
This component shouldn't be used in the following scenarios:
(newOptionLabel: string) => T | Promise<T>
Handler that is called when an option has been added.
(search: string) => void
Handler that is called when the input changes.
(option: T) => void
Handler that is called when a option is selected.
(T | ComboboxOptionGroup<T>)[]
The list of ComboBox options.
Option
The current value.
string
className for the element
string
Maximum height of the dropdown menu.
"content" | "parent"
Whether the Combobox should fit its parents or content.
Default: content"default" | "magicGradient"
The visual style of the Combobox
boolean
Internal props, do not use.
Default: falseboolean
Whether the Combobox is disabled.
boolean
Whether the input should be displayed.
boolean
Whether the Combobox is invalid.
boolean
Whether the Combobox is loading.
string
The name of the Combobox, used when submitting an HTML form.
FocusEventHandler<HTMLInputElement>
Handler that is called when the element loses focus.
FocusEventHandler<HTMLInputElement>
Handler that is called when the element receives focus.
string
Temporary text that occupies the Combobox when it is empty.
"bottom-end" | "bottom-start" | "end-bottom" | "end-top" | "top-end" | "top-start"
Placement the menu will render relative to the field
(rawValue: string) => ReactNode
Function to render the add option item. It should always return a DropdownItem component.
(inputProps: HTMLProps<HTMLInputElement>) => ReactNode
Function to render the input.
({ key }: { key: string | number; }) => ReactNode
Function to render options in a loading state.
(rawValue: string) => ReactNode
Function to render when no options are available
(option: T, state?: { isSelected: boolean; }) => ReactNode
Function to render option.
((optionGroup: ComboboxOptionGroup<T>) => ReactNode) & ((optionGroup: ComboboxOptionGroup<T>) => ReactNode)
Function to render option group.
(option: T) => ReactNode
Function to render the selected options. Act like a leftAddon for the underneath input.
(args: { getInputProps: () => GetInputPropsReturnValue; }) => ReactNode
Function to render the search bar inside the dropdown header. Provides Downshift's getInputProps so the header input supports keyboard navigation (arrow keys, enter, etc.).
boolean
Whether the combobox should show a clear button.
Default: false"noDropdown" | "withDropdown"
The visual style of the Autocomplete.