Combobox

Type to narrow, arrows to move, Enter to choose. Matched text is bold, rows can carry a second line, the chosen row has a tick, and a clear button resets it. Inputs.

Open playground

About

Combobox is a React component in the Inputs category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { Combobox } from "@ashutoshswamy/smoui" and set options[].description, options, label among its 6 props.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { Combobox } from "@ashutoshswamy/smoui";

<Combobox label="City" options={[{ value: "berlin", label: "Berlin" }, { value: "mumbai", label: "Mumbai" }]} onChange={setCity} />

Props 6

options[].description

A second line under the label, searched too.

string
options

Searchable choices.

{ value: string; label: string }[]
label

Visible and accessible field name.

string
value / defaultValue

Controlled or initial option value.

string
onChange

Called when a result is picked.

(value: string) => void
placeholder

Empty-field prompt.

stringdefault "Search"