Form Inputs

Autocomplete

Free-text input with filtered suggestions.

Free-text input with filtered suggestions.

Suggestions#

4 suggestions available

Inline completion#

4 suggestions available

Disabled#

2 suggestions available

Component props#

items accepts unique strings. Users can enter a value that is absent from the suggestions.

PropTypePurpose
itemsreadonly string[]Suggestions to filter and display
labelReactNodeAccessible input label
value / defaultValuestringControlled or initial text
onChange(value: string) => voidCalled after onValueChange, and only for changes that were not canceled
onValueChangeBase UI callbackReceives the value and cancellable event details; runs first
isDisabledbooleanDisables the input (disabled is also accepted)
showClearbooleanShows a clear button while the input has a value
mode'list' | 'both' | 'inline' | 'none'Filtering and inline completion behavior
inputPropsBase UI Input propsInput attributes, including aria-label when no label is shown
positionerPropsBase UI Positioner propsPopup placement
renderItem(item: string) => ReactNodeCustom suggestion content
emptyMessageReactNodeContent shown when no suggestions match

The parts expose data-slot attributes (autocomplete, autocomplete-input, autocomplete-clear, autocomplete-status, autocomplete-positioner, autocomplete-content, autocomplete-list, autocomplete-item, autocomplete-empty), and a visually hidden Autocomplete.Status announces the number of available suggestions.

The forwarded ref targets the input. Other Base UI Autocomplete root props are supported, including open, onOpenChange, filter, and readOnly.