Components
Searchable Select
A select you can type into to filter options.
<SearchableSelect label="Framework" options={frameworks} />Installation
npx shadcn@latest add https://ui.zjkm.tech/r/searchable-select.jsonimport { SearchableSelect } from "@/components/searchable-select"Using JavaScript? Set tsx: false in components.json and the CLI converts it.
New to shadcn? Run npx shadcn@latest init first. The CLI needs components.json and the @/ import alias.
Usage
Type to filter the options, use the arrow keys to move, Enter to choose and Escape to close. It follows the ARIA combobox pattern, so screen readers announce the options as you move.
import { SearchableSelect } from "@/components/searchable-select";
export function FrameworkPicker() {
return <SearchableSelect label="Framework" options={["React", "Preact", "Solid", "Svelte", "Vue", "Angular", "Qwik", "Lit"]} onChange={(v) => console.log(v)} />;
}Props
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | The label. | |
options | string[] | The choices. | |
defaultValue | string | "" | Starting choice. |
onChange | (value: string) => void | Called when a choice is made. | |
placeholder | string | "Type to search…" | Placeholder in the field. |
className | string | Classes for the wrapper. |
It has no animation, so reduced motion changes nothing.