The text is the value, so people can type what the list does not hold. Pass items for the suggestions.
The sample also uses Field. One command adds them with this item:
city-search.tsx
Autocomplete
| Prop | Type | Default | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
From Base UICombobox.RootBase UI docs | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| children | ReactNode | — | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name | string | — | Identifies the field when a form is submitted. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| id | string | — | The id of the component. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
AutocompleteInputGroup
<div>AutocompleteTrigger
<button>| Prop | Type | Default | Description | ||||
|---|---|---|---|---|---|---|---|
| class | string | — | |||||
From Base UIAutocomplete.TriggerBase UI docs | |||||||
| disabled | boolean | false | Whether the component should ignore user interaction. | ||||
| render | — | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render. | |||||
| style | — | Style applied to the element, or a function that returns a style object based on the component's state. | |||||
| |||||||
| ...props | <button> attributes | — | Every other attribute goes to the <button>, with a ref. | ||||
AutocompleteItem
<div>| Prop | Type | Default | Description | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| class | string | — | |||||||||||||||||||||||||||
From Base UIAutocomplete.ItemBase UI docs | |||||||||||||||||||||||||||||
| children | ReactNode | — | |||||||||||||||||||||||||||
| on | — | An optional click handler for the item when selected. It fires when clicking the item with the pointer, as well as when pressing Enter with the keyboard if the item is highlighted when the Input or List element has focus. | |||||||||||||||||||||||||||
| index | number | — | The index of the item in the list. Improves performance when specified by avoiding the need to calculate the index automatically from the DOM. | ||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. | ||||||||||||||||||||||||||
| Down ArroworUp Arrow | Opens the list, then moves the highlight. |
|---|---|
| Enter | Picks the highlighted suggestion. With no highlight, closes the list. |
| Escape | Closes the list. With the list closed, clears the text. |
| HomeorEnd | Moves the caret to the start or the end of the text. |
- ComboboxPick Combobox when the value must be one item, or several items, from a fixed list.
- InputA field for one line of text, such as a name or an email address. It comes in the 3 sizes of Button, with invalid, disabled, and read-only states.
- SelectPick Select for a short fixed list where people pick with no typing.
- CommandPick Command for a ready command palette or quick switcher, with groups, an empty state, and a dialog.
- Search FieldPick Search Field for a plain search query with a shortcut, a clear button, and a debounce, with no popup.
Built with
Installs with Autocomplete









