Start here
  • InstallationAdd Nelumbo to a shadcn project
  • ThemingBrand accent, neutrals, dynamic color
  • Biology componentsSequences, maps, plates and trees
  • katalyx.bio

    Combobox

    A field you type into to find an option in a long list. Typing filters the list and bolds what matched, ignoring case and accents, so “cura” finds Curaçao. With multiple, choices become chips inside the field.

    Install

    npx shadcn@latest add @nelumbo/combobox

    Variants

    The same field as Input and Select. Type to filter, ↑ and ↓ to move, Enter to choose, Escape to put the old value back. Country codes match too: try “ch”.

    filled

    Where your invoices are sent.

    outlined

    Where your invoices are sent.

    Multiple

    Choices become chips and the field grows when they wrap. The list stays open while you pick, and Backspace in the empty input removes the last chip.

    filled

    DesignAccessibility

    2 selected

    outlined

    DesignAccessibility

    2 selected

    Groups, icons and descriptions

    Options with a group are listed under it. Icons and descriptions show in the list; disabled options are skipped by the keyboard.

    Icons at the end

    iconPosition="end" puts icons at the far end, opposite the label, for the whole list or per option. In a single choice, the check moves to the start.

    Nested

    Options with children open level by level. Cascade (the default) opens each level beside its parent, like a desktop menu; drill shows one level at a time with a back row. → or Enter goes in, ← comes back. Typing searches every level at once and groups the matches by path: try “nor” or “nordics”. A parent shows what you chose inside it. On a phone it always drills.

    single

    multiple

    JapanBrazil
    const locations = [  {    value: "europe", label: "Europe", icon: "euro",    children: [      { value: "nordics", label: "Nordics", children: ["Denmark", "Finland", "Sweden"] },      { value: "western", label: "Western Europe", children: ["France", "Ireland"] },    ],  },  { value: "remote", label: "Anywhere (remote)" },]​<Combobox label="Office" options={locations} value={office} onValueChange={setOffice} />

    Searching a server

    Turn off local filtering with filter={false}, search in onInputValueChange, and set loading while the request runs.

    const [query, setQuery] = React.useState("")const { data = [], isLoading } = useQuery({ queryKey: ["cities", query], queryFn: () => searchCities(query) })​<Combobox  label="City"  options={data}  filter={false}  loading={isLoading}  onInputValueChange={setQuery}  value={city}  onValueChange={setCity}/>

    In a form

    Give it a name to submit the value, one entry per chip with multiple.

    Mobile

    Press Enter in a closed field to submit.

    Usage

    import { Combobox } from "@/components/ui/combobox"​// options are strings, or { value, label, description?, icon?, group?, keywords?, disabled? }<Combobox label="Country" options={countries} value={country} onValueChange={setCountry} />​<Combobox multiple label="Labels" options={["Bug", "Design", "Docs"]} value={labels} onValueChange={setLabels} />

    Props

    PropTypeDefaultNotes
    options(string | ComboboxOption)[]{ value, label, description?, icon?, iconPosition?, group?, keywords?, disabled?, children? }
    option children(string | ComboboxOption)[]Makes it a parent that opens a nested panel
    iconPosition"start" | "end""start"Option icons before the label or at the far end
    nestedStyle"cascade" | "drill""cascade"Side menus, or one panel at a time; phones always drill
    searchablebooleantruefalse makes it a select (NestedSelect)
    displayPathbooleanfalseShow the chosen option's path in the field
    value / defaultValuestring | null, or string[] with multipleonValueChange gets the same type
    multiplebooleanfalseChips in the field; the list stays open
    inputValue / onInputValueChangestring / (text) => voidThe typed text
    filterfalse | (option, query) => booleanlabel and keywords, ignoring case and accentsfalse for server search
    loadingbooleanfalseSpinner in the field, and in an empty list
    emptyMessageReactNode"No results"
    clearablebooleantrueClear button once there's a value
    namestringHidden input(s) for forms
    label, variant, size, icon, description, errorAs on Input