Sophic Interface Systems
Components

Nested Combobox

One search field for a two-level choice, such as a country and then a bank in it.

Only banks that support this kind of payment are listed.

You might be looking for:

  • Select

    Pick one value from a short list.

  • Combobox

    Type to search a long list, then pick one.

  • Dropdown Menu

    Commands from a button — each row runs an action.

Use it when the second list depends on the first: pick a country, then a bank in that country. The chosen parent becomes a chip in the field and scopes the search, so one field and one list do the work of two. That keeps it compact on small screens and inside a dialog or drawer.

  • No parent chosen: the field searches parents.
  • Parent chosen: the field searches that parent's options. Remove the chip (or press Backspace in an empty field) to go back to the parents; the chosen option clears too.
  • Option chosen: the closed field shows its mark and label, with the parent's mark at the end.

Search ignores case and accents and matches every word in any order, so "gen soc" finds "Société Générale". Each option can add keywords (a code, a former name) that match too.

Playground

<NestedCombobox  aria-label="Your bank"  parents={countries}  parentValue={country}  onParentValueChange={setCountry}  options={banks}  value={bank}  onValueChange={setBank}  parentPlaceholder="Search for your bank's country"  placeholder={`Search banks in ${countryName}`}/>

Usage

import { NestedCombobox } from "@sophic/portal-ui/components/ui/nested-combobox";
<Field>
  <FieldLabel htmlFor="bank">Your bank</FieldLabel>
  <NestedCombobox
    id="bank"
    parents={countries}
    parentValue={country}
    onParentValueChange={setCountry}
    options={banks}
    loading={banksLoading}
    value={bank}
    onValueChange={setBank}
    parentPlaceholder="Search for your bank's country"
    placeholder={`Search banks in ${countryName}`}
  />
</Field>

Both levels are controlled. Load options for the chosen parent and pass loading while they arrive, or error when they fail; both show in place of the rows. Start parentValue on a likely default (the customer's own country) so most people go straight to the second step.

Props

Prop

Type

Default

Each row is a NestedComboboxOption: value, label, and optional icon, suffix, keywords and disabled.

Changelog

On this page