Autocomplete
Suggestions as you type, like chat commands.
Install and use
The first command adds the component and the Mine theme, the second adds this example. Render <Mine> once near your root for the skin, sounds and narrator.
"use client"
import {
Autocomplete,
AutocompleteContent,
AutocompleteEmpty,
AutocompleteInput,
AutocompleteItem,
AutocompleteLabel,
AutocompleteList,
} from "@/components/ui/autocomplete"
const fruits = [
"Apple",
"Apricot",
"Avocado",
"Banana",
"Blackberry",
"Blueberry",
"Cherry",
"Grape",
"Lemon",
"Mango",
"Orange",
"Peach",
"Pear",
"Pineapple",
"Strawberry",
]
function Example() {
return (
<Autocomplete>
<div data-slot="stack">
<AutocompleteLabel>Favorite fruit</AutocompleteLabel>
<AutocompleteInput placeholder="e.g. Mango" />
</div>
<AutocompleteContent>
<AutocompleteEmpty>No fruits found.</AutocompleteEmpty>
<AutocompleteList>
{fruits.map((fruit) => (
<AutocompleteItem key={fruit} value={fruit}>
{fruit}
</AutocompleteItem>
))}
</AutocompleteList>
</AutocompleteContent>
</Autocomplete>
)
}
export { Example }