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#

Autocomplete props
PropTypeDefault
optionsstring[]SAMPLE_OPTIONS
valuestring-
onChange(value: string) => void-
placeholderstring"Search…"
disabledboolean-
classNamestring-
idstring-
aria-labelstring-

Dependencies#

npm

React only

Built from

Examples#

All form components

Learn more