Autocomplete
Text input that filters string options as you type, using ARIA combobox and listbox roles. Works controlled or uncontrolled and lists up to eight matches.
src/registry/ui/autocomplete.tsx/r/autocomplete.json
Installation#
bash
npx shadcn@latest add @minidev/autocomplete
MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/autocomplete.json
Usage#
tsx
import { Autocomplete } from "@/components/ui/autocomplete"
export function Example() {
return (
<Autocomplete options={items.map(i=>i.label)} placeholder="Framework" aria-label="Framework" />
)
}
API reference#
| Prop | Type | Default |
|---|---|---|
options | string[] | SAMPLE_OPTIONS |
value | string | - |
onChange | (value: string) => void | - |
placeholder | string | "Search…" |
disabled | boolean | - |
className | string | - |
id | string | - |
aria-label | string | - |
Dependencies#
npm
React only
Built from
Examples#
Related forms components#
Calendar MonthMonth calendar grid with weekday headers and clickable day cells that highlight the selected date. A simple Tailwind base for date views and schedulers.Character CountLive React character counter that shows the current count against a limit and turns red when it goes over. Announces changes politely to screen readers.Checkbox GroupVertical wrapper that groups related checkboxes under role group with even spacing. Use it with Checkbox and labels for multi select settings.CheckboxShadcn style checkbox on Base UI with an animated check, indeterminate state, invalid and disabled styles, and an enlarged hit area for touch.Chip FilterSingle select filter chips in React that behave as a radio group, with an accent ring on the active chip. Good for quick filters above lists and tables.Choice CardSelectable React card button with an icon, title and description, using aria-pressed and an accent outline when chosen. Suits plan pickers and onboarding.
All form components