Combobox

Searchable single or multiple select, with creatable options and hints.

Category
Forms
Access
Free with an account
Source
237 lines · one file

The decision inside it

No buttons hidden inside the button

The chips carry no × of their own: a button inside the trigger is two controls in one Tab stop, which screen readers cannot use. Picking an item again removes it, and Backspace in an empty search removes the last one.

When to use it

Use Combobox instead of Select when the list is long enough that people would rather type: countries, team members, tags. Add keywords so an email finds a person, set multiple for tags, and pass onCreate to let people add an option that does not exist yet.

Installation

How you get it

Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.

Use Liro's Combobox for this.
Install it: npx shadcn@latest add @liro/combobox
(the @liro registry is set up in components.json, with LIRO_KEY in .env.local)
Import it from @/components/ui/combobox.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.

For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Free components install through the @liro registry with your CLI token: see the Namespaced tab.

Usage

components/assignee-picker.tsx
"use client";

import * as React from "react";
import { Combobox, type ComboboxOption } from "@/components/ui/combobox";

const people: ComboboxOption[] = [
  { value: "ana", label: "Ana Diaz", hint: "Design", keywords: ["ana@acme.com"] },
  { value: "li", label: "Li Wei", hint: "Engineering", keywords: ["li@acme.com"] },
];

export function AssigneePicker() {
  const [value, setValue] = React.useState<string[]>([]);
  return (
    <Combobox
      multiple
      aria-label="Assignees"
      options={people}
      value={value}
      onValueChange={setValue}
      placeholder="Assign people"
      searchPlaceholder="Search by name or email"
    />
  );
}

API reference

“Copy prompt” above puts a full brief on your clipboard, install command, dependencies, props, and the mistakes an assistant usually makes with this component.

Dependencies

npm packages

clsxcmdklucide-reacttailwind-merge

Liro foundations, installed alongside it

liro-themefieldpopover

Accessibility

  • Keyboard reachable throughout, in visual order
  • Focus trapped in overlays, Escape closes them
  • Focus returns to whatever opened it
  • Live regions announce what changed, not that something did
  • Honours prefers-reduced-motion

Responsive behavior

  • Sizes to its container, not the viewport
  • Usable from 320px up
  • Pointer-based interaction, so trackpad and touch both work
  • No hover-only affordances