Skip to content
HomeCobalt

Combobox

Picks one value, or several, out of a list too long to scroll through: you type, and the list narrows to what matches.

Examples

Type to narrow 60 cities to the few that match; arrows or the pointer move the highlight.
Server resultsResults come from a server; the last answer stays, dims and says Searching only past 250ms.
Several valuesSeveral values sit as chips in the field; pick from the list, and remove one with its cross or Backspace.
Countries with their flagsType to narrow forty countries; each option leads with its flag, and the field shows the chosen country's.
In a fieldThe label names the input, and the description says what the pick changes.

Check-in times on your listings follow this zone.

States

Set by your organisation for every payout.

DisabledDisabled through the Field: it keeps its value at half opacity, does not open, and says why.
Choose the airport you land at, so the host can plan the pickup.
InvalidThe red wash on the field and an error that says what to pick, until an airport is chosen.

Usage

Use it when

  • Picking one of more than 10 known values, such as a city, a time zone or an adviser.
  • Picking several values from a list, shown as chips, such as strategies or regions.
  • Picking from results a server finds as you type.

Use something else when

  • Up to 10 options that need no typing. Use Select instead.
  • Two to six choices that each need their words in view. Use RadioGroup instead.
  • Free text with suggestions, where any text is a valid answer. Use Input instead.
  • Jumping to a record or running a command from anywhere in the app. Use CommandPalette instead.

Rules

General

Content

Avoid

Limits

Install

npx shadcn@latest add https://kaanarici.com/r/cobalt/combobox.json
import { Combobox, ComboboxInput, ComboboxContent, ComboboxList, ComboboxItem, ComboboxEmpty, ComboboxStatus, ComboboxGroup, ComboboxGroupLabel, ComboboxCollection, ComboboxChips, ComboboxChip, ComboboxChipsInput, ComboboxValue } from "@/components/cobalt/ui/combobox"