Flutter docs
Default skin

AutoComplete

Autocomplete function of input field.

When to use

  • When you need an input box instead of a selector.
  • When you need input suggestions or helping text.

The differences with Select are:

  • AutoComplete is an input box with text hints, and users can type freely. The keyword is aiding input.
  • Select is selecting among given choices. The keyword is select.

Examples

Basic Usage

Basic Usage, set data source of autocomplete with options property.

Customize Input Component

Customize Input Component

Lookup-Patterns - Certain Category

Demonstration of Lookup Patterns: Certain Category. Basic Usage, set options of autocomplete with options property.

Status

Add status to AutoComplete with status, which could be error or warning.

Customize clear button

Customize clear button

Customized

You could set custom Option label

Non-case-sensitive AutoComplete

A non-case-sensitive AutoComplete

Lookup-Patterns - Uncertain Category

Demonstration of Lookup Patterns: Uncertain Category.

Variants

There are outlined, filled, borderless, and underlined variants to choose from.

Custom semantic dom styling

You can customize the semantic dom style of AutoComplete by passing objects/functions through classNames and styles.

API

AutoComplete and its props are exported from @ceebee/ui/client.

AutoComplete

PropertyDescriptionTypeDefaultVersion
allowClearShow clear buttonboolean | { clearIcon?: ReactNode }false5.8.0: Support Object type
backfillIf backfill selected item the input when using keyboardbooleanfalse—
childrenCustomize input elementHTMLInputElement | HTMLTextAreaElement | React.ReactElement<InputProps><Input />—
classNamesCustomize class for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, string> | (info: { props })=> Record<SemanticDOM, string>-—
dataSourceData source of autocomplete options, please use options insteadDataSourceItemType[]--
defaultActiveFirstOptionWhether active first option by defaultbooleantrue—
defaultOpenInitial open state of dropdownboolean-—
defaultValueInitial selected optionstring-—
disabledWhether disabled selectbooleanfalse—
dropdownClassNameThe className of dropdown menu, please use classNames.popup.root insteadstring--
dropdownMatchSelectWidthDetermine whether the dropdown menu and the input are the same width, please use popupMatchSelectWidth insteadboolean | numbertrue-
dropdownRenderCustomize dropdown content, use popupRender instead(originNode: ReactNode) => ReactNode-4.24.0
popupRenderCustomize dropdown content(originNode: ReactNode) => ReactNode-—
dropdownStyleThe style of dropdown menu, use styles.popup.root insteadCSSProperties-—
popupClassNameThe className of dropdown menu, use classNames.popup.root insteadstring-4.23.0
popupMatchSelectWidthDetermine whether the dropdown menu and the select input are the same width. Default set min-width same as input. Will ignore when value less than select width. false will disable virtual scrollboolean | numbertrue—
filterOptionIf true, filter options by input, if function, filter options against it. The function will receive two arguments, inputValue and option, if the function returns true, the option will be included in the filtered set; Otherwise, it will be excludedboolean | function(inputValue, option)true—
getPopupContainerParent node of the dropdown. Default to body, if you encountered positioning problems during scroll, try changing to the scrollable area and position relative to it. Examplefunction(triggerNode)() => document.body—
notFoundContentSpecify content to show when no result matchesReactNode-—
openControlled open state of dropdownboolean-—
optionsSelect options. Will get better perf than jsx definition{ label, value }\[]-—
placeholderThe placeholder of inputstring-—
showSearchsearch for configurationtrue | Objecttrue—
statusSet validation status'error' | 'warning'-4.19.0
sizeThe size of the input boxlarge | medium | small-—
valueSelected optionstring-—
stylesCustomize inline style for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, CSSProperties> | (info: { props })=> Record<SemanticDOM, CSSProperties>-—
variantVariants of inputoutlined | borderless | filled | underlinedoutlined5.13.0
virtualDisable virtual scroll when set to falsebooleantrue4.1.0
onBlurCalled when leaving the componentfunction()-—
onChangeCalled when selecting an option or changing an input valuefunction(value)-—
onDropdownVisibleChangeCalled when dropdown open, use onOpenChange instead(open: boolean) => void-—
onOpenChangeCalled when dropdown open(open: boolean) => void-—
onFocusCalled when entering the componentfunction()-—
onSearchCalled when searching itemsfunction(value)-—
onSelectCalled when a option is selected. param is option's value and option instancefunction(value, option)-—
onClearCalled when clearfunction-4.6.0
onInputKeyDownCalled when key pressed(event: KeyboardEvent) => void-—
onPopupScrollCalled when dropdown scrolls(event: UIEvent) => void-—

showSearch

PropertyDescriptionTypeDefaultVersion
filterOptionIf true, filter options by input, if function, filter options against it. The function will receive two arguments, inputValue and option, if the function returns true, the option will be included in the filtered set; Otherwise, it will be excludedboolean | function(inputValue, option)true—
onSearchCalled when searching itemsfunction(value)-—
blur()Remove focus———
focus()Get focus———