Skip to content

Inputs

Combobox

A text input that filters a list as you type, for choosing one item from many: people, clients, countries, currencies. Matching ignores case and accents, options can carry an icon and a second line, and there's a clear empty state when nothing matches.

On this page
AM

Usage

components/ui/combobox.tsx
import { Combobox } from "@/components/ui/combobox";import { Field } from "@/components/ui/field"; const currencies = [  { value: "eur", label: "Euro", description: "EUR · €" },  { value: "usd", label: "US dollar", description: "USD · $" },]; export function Example() {  return (    <Field label="Currency">      <Combobox options={currencies} defaultValue="eur" />    </Field>  );}

Examples

Assignee

AM

Type “zz” to see the empty state. Matching also checks keywords, so “Deutschland” finds Germany.

Controlled

Pass value and onValueChange to drive other UI from the selection. The clear button sets the value to null.

Next invoice: Ledgerly

Sizes and states

Pick a project for this time entry.

Only admins can change the owner.

Props

  • optionsrequiredComboboxOption[]default: —{ value, label, description?, icon?, keywords?, disabled? }.
  • value / defaultValuestring | nulldefault: —Controlled or initial selected value.
  • onValueChange(value: string | null) => voiddefault: —Called on select and on clear (null).
  • placeholderstringdefault: "Search…"Shown when nothing is selected.
  • emptyMessageReactNodedefault: "No results"Shown when the search matches nothing.
  • clearablebooleandefault: trueShow a clear button when a value is selected.
  • size"sm" | "md" | "lg"default: "md"Height 32 / 36 / 40px.
  • invalid / disabledbooleandefault: —Set automatically inside a Field with error or disabled.
  • namestringdefault: —Adds a hidden input with the selected value for forms.
  • aria-labelstringdefault: —Needed when there's no Field label.

Accessibility

  • Follows the WAI-ARIA combobox pattern: the input has role="combobox", aria-expanded and aria-controls pointing at a role="listbox".
  • Focus stays in the input. Down and Up open the list and move the highlight, which is announced through aria-activedescendant; Home and End jump to the ends.
  • Enter selects the highlighted option, Escape closes the list (and clears the value when the list is already closed), Tab closes and moves on.
  • Options use role="option" with aria-selected; disabled options have aria-disabled and are skipped by the arrow keys.
  • The selected option shows a check mark in addition to the highlight color.

Suggested