Skip to content

Combobox

Searchable autocomplete dropdown control combining text input typing with filtered Radix Popover item selection.

// Plain markup
import { Combobox } from "@shavin/ui";

Search or type a new value

Typing filters the list. Whatever is typed is the value, so people can enter a merchant that is not listed yet.

Component Source
import { useState } from "react";
import { Combobox } from "@shavin/ui";

const MERCHANTS = ["Costco", "Trader Joe's", "Whole Foods", "Target", "Shell", "Netflix", "Spotify", "City Water & Power"];

export function MerchantField() {
  const [merchant, setMerchant] = useState("");
  return (
    <div className="flex w-64 flex-col gap-1.5">
      <label htmlFor="merchant" className="text-sm font-medium text-fg">Merchant</label>
      <Combobox
        id="merchant"
        value={merchant}
        onChange={setMerchant}
        options={MERCHANTS}
        placeholder="Search or add a merchant"
      />
    </div>
  );
}

Small, without hover preview

size is sm or md (default). hoverPreview (default true) shows the hovered option in the field; set it to false so the value only changes on click or Enter.

Component Source
const CURRENCIES = ["USD", "EUR", "GBP", "CAD", "AUD", "JPY", "INR"];
const [currency, setCurrency] = useState("USD");

<Combobox
  aria-label="Currency"
  size="sm"
  hoverPreview={false}
  value={currency}
  onChange={setCurrency}
  options={CURRENCIES}
/>

Select, Dropdown or Combobox

SelectDropdownCombobox
Best forPicking one value from a styled list, with groups or leading iconsCompact pickers and filters; the native variant for the OS picker on phonesLong lists people search by typing, or values that may not be in the list
PopupCustom listbox (Radix Select)Custom listbox by default; variant="native" renders a real <select>Text input with a filtered list
Free textNoNoYes, any typed string is the value
Options{ value, label, prefix? } or groups{ value, label }Strings
Sizessm, md, lgsm, mdsm, md
Empty stateShows placeholder until something is pickedStarts on the first optionShows placeholder while empty

All three support arrow keys, Enter and Escape. Select and the default Dropdown also jump to an option as you type its first letters.

Props

PropTypeDefaultDescription
value*string—Selected or typed string value.
onChange*(value: string) => void—Callback fired when user selects or types a value string.
options*string[]—List of string option items for autocomplete filtering.
prettyOptionLabel(val: string) => string—Optional formatter function for option labels.
size"sm" | "md"mdSize variant: "sm" (32px height) or "md" (40px height), matching Select sm and md. Default "md".
hoverPreviewbooleantrue;Preview the hovered option in the field as you move over the list. Default true; set false for a plain select that only applies on click.

* required

Configure Theme
Theme
Brand Color
Custom
Gray Family
Appearance
Radius
Scaling
Panel Style
Heading Font
Body Font