AutoComplete

Designer doc
AutoComplete its an enhanced input component which helps user with a list of suggested options

Example

Single Text
By default AutoComplete its a controlled single-line textbox, which only allow predefined values through AutoCompleteOption.
View code
To allow it preserve arbitrary values that user types in, you might specify isFreeText to true. Additionally, inputValue & onInputChange props combination are more recommended over value & onChange props combination in such case, since value will only be updated when selecting an option with predefined value.
By playing around with the example below, you will see that inputValue will be synced up with the text in the input box in a real time manner, while value is not be updated when you are typing.
View code
Multiple values
To allow multiple format, you might specify isMultiple to true. Selected values will be displayed in chips format and saved through value prop. More over, value will be required to pass in string[] type which the onChange function will take in the same type as its param.
View code
To allow both selected chips + search keyword be preserved, you might also set isFreeText to true. This will make sure inputValue is not cleared when the combobox lose focus.
View code
openOnClick
By default, clicking on the input box without inputValue will not open the dropdown, you might change this behavior by setting openOnClick to true.
View code

Customization

There are some customization you might consider to suit your use case.

Integrate with API query
For example, after getting the data from an api call, you might want to decide only open the dropdown list based on the number of options.
View code
Add option
To make the data source more flexible, you might want to allow new options based on the user’s input. In the example below, you can try typing names that are not part of the predefined data source and select them
View code
Customized render
Also, the ui rendered in the dropdown list and input box can both be customized.
View code
By default AutoCompleteList popup is placed by referencing to AutoCompleteInput, the dropdown reference can be modified via popperReference.
View code

References

API

AutoComplete
Prop nameTypeDefaultDescription
idstring
initialInputValuestring
initialIsOpenboolean
initialValuestring | string[]
inputValuestring
isFreeTextboolean
isMultipleboolean
isOpenboolean
onChange((values: string[]) => void) | ((val: string) => void)
onInputChange(val: string) => void
onIsOpenChange(isOpen: boolean) => void
openOnClickboolean
by default,clicking input box will not open dropdown, it will be opened after user starts typing, if set to true, click will trigger the dropdown open directly
stateReducerAcdcStateReducer(state, { nextState }) => nextState
valuestring | string[]
AutoCompleteChip
Prop nameTypeDefaultDescription
asany
Tag or component, but a simple tag (i.e. built-in components, e.g. div, span) is recommended.
clickableboolean
descriptionReactNode
Description to show for capsule-large choice and filter chips.
disableNavigationboolean
disabledboolean
Equivalent to button's disabled property.
ellipsisTooltipPropsOmit<EllipsisTooltipProps, "children">
indexnumber
Order index for keyboard navigation using arrow keys. By default, this prop is automatically added by the parent.
invalidboolean
keyboardClickKeysstring[]
leftElementReactNode
Element to be added on the left side of the label. Equivalent to adding the element manually on the label with a certain margin.
onBlurFocusEventHandler<HTMLDivElement>
onClickMouseEventHandler<HTMLDivElement>
onDelete(e: SyntheticEvent<HTMLDivElement, Event>) => void
Callback on Backspace key or delete icon is clicked. If this callback is not provided, icon is not rendered - meaning it's not deletable.
onKeyDownKeyboardEventHandler<HTMLDivElement>
onKeyUpKeyboardEventHandler<HTMLDivElement>
onMouseDownMouseEventHandler<HTMLDivElement>
onMouseLeaveMouseEventHandler<HTMLDivElement>
onMouseUpMouseEventHandler<HTMLDivElement>
onReleaseEventHandler<SyntheticEvent<HTMLDivElement, Event>>
Callback that's triggered after click i.e. mouseup and keyup of enter or space.
onTouchEndTouchEventHandler<HTMLDivElement>
onTouchStartTouchEventHandler<HTMLDivElement>
rightElementReactNode
Element to be added on the right side of the label. Equivalent to adding the element manually on the label with a certain margin.
ripplePropsRippleProps
Props to customize ripple effect, which is reusing Ripple component in coral
tabIndexnumber-1
valuestring
variantChipVariants
AutoCompleteHighlighter
Prop nameTypeDefaultDescription
textstring
AutoCompleteInput
Prop nameTypeDefaultDescription
asany
Tag or component, but a simple tag (i.e. built-in components, e.g. div, span) is recommended.
childrenReactNode
children props only available when isMultiple = true, which will allow you to customize the chips
chipListPropsChipListProps
disableChipNavigationboolean
disabledboolean
Equivalent to button's disabled property.
fullWidthboolean
inputPropsAutoCompleteSearchProps & { ref?: MutableRefObject<HTMLInputElement>; }
keyboardClickKeysstring[]
onBlurFocusEventHandler<HTMLDivElement>
onClickMouseEventHandler<HTMLDivElement>
onKeyDownKeyboardEventHandler<HTMLDivElement>
onKeyUpKeyboardEventHandler<HTMLDivElement>
onMouseDownMouseEventHandler<HTMLDivElement>
onMouseLeaveMouseEventHandler<HTMLDivElement>
onMouseUpMouseEventHandler<HTMLDivElement>
onReleaseEventHandler<SyntheticEvent<HTMLDivElement, Event>>
Callback that's triggered after click i.e. mouseup and keyup of enter or space.
onTouchEndTouchEventHandler<HTMLDivElement>
onTouchStartTouchEventHandler<HTMLDivElement>
placeholderReactNode
AutoCompleteList
Prop nameTypeDefaultDescription
asvoid | WebTarget
Tag or component, but a simple tag (i.e. built-in components, e.g. div, span) is recommended.
forwardedAsvoid | WebTarget
themeDefaultTheme
AutoCompleteOnMount
AutoCompleteOption
Prop nameTypeDefaultDescription
asany
Tag or component, but a simple tag (i.e. built-in components, e.g. div, span) is recommended.
disabledboolean
indexnumber
valuestring
AutoCompleteScroller
Prop nameTypeDefaultDescription
asany
Tag or component, but a simple tag (i.e. built-in components, e.g. div, span) is recommended.
containerHTMLElementconfigs.getPortalContainer('AutoCompleteList', 'container')
elevationLevelnumber1
immediateboolean
placement"left" | "right" | "bottom" | "top" | "top-start" | "top-end" | "left-start" | "left-end" | "right-start" | "right-end" | "bottom-start" | "bottom-end"bottom
popperReferenceHTMLElement
popperUpdateKeystring
widthSelectListWidth
AutoCompleteSearch
Prop nameTypeDefaultDescription
asany
Tag or component, but a simple tag (i.e. built-in components, e.g. div, span) is recommended.
    Example
    Example
    Single Text
    Single Text
    Multiple values
    Multiple values
    openOnClick
    openOnClick
    Customization
    Customization
    Integrate with API query
    Integrate with API query
    Add option
    Add option
    Customized render
    Customized render
    Popup position
    Popup position
    References
    References
    API
    API
    AutoComplete
    AutoComplete
    AutoCompleteChip
    AutoCompleteChip
    AutoCompleteHighlighter
    AutoCompleteHighlighter
    AutoCompleteInput
    AutoCompleteInput
    AutoCompleteList
    AutoCompleteList
    AutoCompleteOnMount
    AutoCompleteOnMount
    AutoCompleteOption
    AutoCompleteOption
    AutoCompleteScroller
    AutoCompleteScroller
    AutoCompleteSearch
    AutoCompleteSearch
Coral is a thoroughly developed design system widely adopted by developers and designers for creating beautiful and user-friendly Sea internal products.

Copyright © 2018-2025 Sea Labs