Search input with suggestions dropdown.
import { Autocomplete } from "@/components/ui";<Autocomplete
options={[
{ value: "react", label: "React" },
{ value: "vue", label: "Vue" },
{ value: "angular", label: "Angular" },
]}
placeholder="Search frameworks..."
/>Load options on search
const [options, setOptions] = useState([]);const [loading, setLoading] = useState(false);const handleSearch = async (query) => { setLoading(true); const results = await searchUsers(query); setOptions(results); setLoading(false);};return ( <Autocomplete options={options} onSearch={handleSearch} loading={loading} placeholder="Search users..." />);Allow custom values
<Autocomplete options={commonEmails} freeSolo placeholder="Enter email..."/>Custom option rendering
<Autocomplete options={users} renderOption={(option) => ( <div className="flex items-center gap-2"> <Avatar size="sm" name={option.label} /> <span>{option.label}</span> </div> )} placeholder="Search users..."/>Configure your app with the features you need and download production-ready code.
Start Configuring