Autocomplete

Forms

A text input with search suggestions. Use autocomplete when users need to search or filter through a large list of options.

Import

import { Autocomplete } from "@/components/ui/autocomplete";

Usage

Product Search

Autocomplete with product options and descriptions

Country Selection

Simple autocomplete without descriptions

With Error

Autocomplete showing error state

Please select a product

Disabled

Autocomplete in disabled state

API Reference

PropTypeDefaultDescription
options*AutocompleteOption[]Array of options with value, label, and optional description
valuestringControlled selected value
defaultValuestringDefault selected value (uncontrolled)
onValueChange(value: string) => voidHandler called when selection changes
onInputChange(input: string) => voidHandler called when input text changes
labelstringLabel text displayed above the input
placeholderstring"Search..."Placeholder text
loadingbooleanfalseShow loading indicator
allowCustomValuebooleanfalseAllow values not in the options list
emptyMessagestring"No results found"Message shown when no options match
errorstringError message to display
disabledbooleanfalseWhether the autocomplete is disabled

Related Components