Skip to Content
zjkm-ui
Components

Searchable Select

A select you can type into to filter options.

Props
<SearchableSelect label="Framework" options={frameworks} />

Installation

npx shadcn@latest add https://ui.zjkm.tech/r/searchable-select.json
import { 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

PropTypeDefaultDescription
labelstringThe label.
optionsstring[]The choices.
defaultValuestring""Starting choice.
onChange(value: string) => voidCalled when a choice is made.
placeholderstring"Type to search…"Placeholder in the field.
classNamestringClasses for the wrapper.

It has no animation, so reduced motion changes nothing.

On this page