Xzero UI
Pro library

Combobox

Search and select from a list without leaving the field.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui/combobox
Live · keyboard ready

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui/combobox

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { Combobox } from "@/components/xzero/combobox/combobox";

const timezones = [
  { value: "utc", label: "UTC" },
  { value: "cet", label: "Central European", keywords: ["zurich", "berlin"] },
  { value: "pst", label: "Pacific", keywords: ["san francisco"] },
];

export function TimezoneField() {
  const [zone, setZone] = useState("");
  return <Combobox label="Time zone" options={timezones} value={zone} onValueChange={setZone} />;
}

API reference

Combobox

A searchable single-select field: type to filter, pick from a listbox that follows its height on a spring.

PropTypeDefaultDescription
label (required)string–Visible label, also used to name the listbox.
options (required)ComboboxOption[]–{ value, label, disabled?, keywords? }. Keywords also match the query.
valuestring–Controlled selected value. Empty string means none.
defaultValuestring""Initial value when uncontrolled.
onValueChange(value: string) => void–Called with the new value, or an empty string when cleared.
descriptionstring–Helper copy under the field, linked through aria-describedby.
placeholderstring"Search or select…"Shown when nothing is selected. While searching, the chosen label shows here instead.
emptyMessagestring"No matches found"Shown in a status row when the filter matches nothing.
classNamestring–Added to the control wrapper.
...propsOmit<InputHTMLAttributes<HTMLInputElement>, "value" | "defaultValue" | "onChange" | "placeholder">–Forwarded to the input, including ref, id, name, disabled, and onFocus.

Keyboard interactions

KeysAction
ArrowDown / ArrowUpOpens the list, then moves through enabled options, wrapping at the ends.
EnterSelects the active option.
EscapeCloses the list and discards the query.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Also in selects

Guidance for AI tools

Combobox: Search and select from a list without leaving the field. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components