# Combobox

Search and select one or more values from a collection.

Search and select one or more values from a collection.

<p className="zenos-base-ui-source">
  Backed by <a href="https://base-ui.com/react/components/combobox">Base UI Combobox</a> for
  upstream behavior and configuration. Zenos owns the public API, styling, and composition shown on
  this page.
</p>

```tsx
import { Combobox } from "@zentara-co/zenos-ui";

const teams = ["Design", "Engineering", "Operations"];

function ComboboxExample() {
  return (
    <div className="w-full max-w-sm">
      <Combobox.Root items={teams}>
        <Combobox.InputGroup>
          <Combobox.Input aria-label="Team" placeholder="Search teams" />
          <Combobox.Trigger aria-label="Show teams" />
        </Combobox.InputGroup>
        <Combobox.Content>
          <Combobox.Empty>No teams found.</Combobox.Empty>
          <Combobox.List>
            {(team: string) => (
              <Combobox.Item key={team} value={team}>
                {team}
              </Combobox.Item>
            )}
          </Combobox.List>
        </Combobox.Content>
      </Combobox.Root>
    </div>
  );
}
```

## Popup search

Use a standalone trigger when the selected value should remain separate from filtering. The popup places a padded, borderless search row (with a magnifying-glass icon) above the result list, following the Argus selection pattern. List options use the same styling as [`Autocomplete`](/components/autocomplete/).

```tsx
import { Combobox, Field, Stack } from "@zentara-co/zenos-ui";

function ComboboxPopupSearchExample() {
  const popupTeams = ["Design", "Engineering", "Operations", "Research"];

  return (
    <Stack gap="5" className="w-full max-w-sm">
      <Field.Root>
        <Field.Label>Primary team</Field.Label>
        <Combobox.Root items={popupTeams} defaultValue="Engineering">
          <Combobox.Trigger aria-label="Primary team">
            <Combobox.Value placeholder="Select a team" />
          </Combobox.Trigger>
          <Combobox.Content>
            <Combobox.InputGroup>
              <Combobox.Input placeholder="Search teams" />
            </Combobox.InputGroup>
            <Combobox.Empty>No teams found.</Combobox.Empty>
            <Combobox.List>
              {(team: string) => (
                <Combobox.Item key={team} value={team}>
                  {team}
                </Combobox.Item>
              )}
            </Combobox.List>
          </Combobox.Content>
        </Combobox.Root>
      </Field.Root>

      <Field.Root>
        <Field.Label>Participating teams</Field.Label>
        <Combobox.Root items={popupTeams} multiple defaultValue={["Design", "Research"]}>
          <Combobox.Trigger aria-label="Participating teams">
            <Combobox.Value placeholder="Select teams" />
          </Combobox.Trigger>
          <Combobox.Content>
            <Combobox.InputGroup>
              <Combobox.Input placeholder="Search teams" />
            </Combobox.InputGroup>
            <Combobox.Empty>No teams found.</Combobox.Empty>
            <Combobox.List>
              {(team: string) => (
                <Combobox.Item key={team} value={team}>
                  {team}
                </Combobox.Item>
              )}
            </Combobox.List>
          </Combobox.Content>
        </Combobox.Root>
      </Field.Root>
    </Stack>
  );
}
```

```text
Combobox.Root
├── Combobox.InputGroup
│   ├── Combobox.Input
│   ├── Combobox.Clear
│   └── Combobox.Trigger
└── Combobox.Content
    ├── Combobox.Empty
    ├── Combobox.List
    │   ├── Combobox.Group
    │   ├── Combobox.Item
    │   └── Combobox.Separator
    └── Combobox.Status
```

## Import

```tsx
import { Combobox } from "@zentara-co/zenos-ui";
```

## Sizes

`Combobox.InputGroup` uses the shared `sm`, `md`, and `lg` control scale from [`Input`](/components/input/).

```tsx
import { Combobox, Stack } from "@zentara-co/zenos-ui";

const teams = ["Design", "Engineering", "Operations"];

function ComboboxSizesExample() {
  return (
    <Stack gap="3" className="w-full max-w-sm">
      {(["sm", "md", "lg"] as const).map((size) => (
        <Combobox.Root key={size} items={teams}>
          <Combobox.InputGroup size={size}>
            <Combobox.Input placeholder={`Size ${size}`} aria-label={`Team size ${size}`} />
            <Combobox.Trigger aria-label={`Show ${size} team list`} />
          </Combobox.InputGroup>
        </Combobox.Root>
      ))}
    </Stack>
  );
}
```

## Variants

Choose a surface that matches the field hierarchy. `default`, `filled`, and `none` match Input. Standalone `Combobox.Trigger` (popup search) uses the same variants when it is not nested in `Combobox.InputGroup`.

```tsx
import { Combobox, Field, Grid } from "@zentara-co/zenos-ui";

const teams = ["Design", "Engineering", "Operations"];

function ComboboxVariantsExample() {
  return (
    <Grid columns={{ base: 1, md: 3 }} gap="4" className="w-full">
      {(["default", "filled", "none"] as const).map((variant) => (
        <Field.Root key={variant} id={`combobox-${variant}`}>
          <Field.Label className="capitalize">{variant}</Field.Label>
          <Combobox.Root items={teams}>
            <Combobox.InputGroup variant={variant}>
              <Combobox.Input placeholder="Search teams" />
              <Combobox.Clear aria-label={`Clear ${variant} team`} />
              <Combobox.Trigger aria-label={`Show ${variant} teams`} />
            </Combobox.InputGroup>
            <Combobox.Content>
              <Combobox.Empty>No teams found.</Combobox.Empty>
              <Combobox.List>
                {(team: string) => (
                  <Combobox.Item key={team} value={team}>
                    {team}
                  </Combobox.Item>
                )}
              </Combobox.List>
            </Combobox.Content>
          </Combobox.Root>
        </Field.Root>
      ))}
    </Grid>
  );
}
```

## Disabled and invalid

Compose with `Field` for shared label, description, and error semantics. Hover, focus, invalid, and disabled treatments follow the Input spec: the **input group** (or standalone trigger) owns the 2px focused border and pressed background—no inner focus ring on the text field, clear, or trigger affordances. Popup search rows keep a bottom border only.

```tsx
import { Combobox, Field, Grid } from "@zentara-co/zenos-ui";

const teams = ["Design", "Engineering", "Operations"];

function ComboboxStatesExample() {
  return (
    <Grid columns={{ base: 1, md: 2 }} gap="4" className="w-full">
      <Field.Root disabled>
        <Field.Label>Disabled</Field.Label>
        <Combobox.Root items={teams} disabled>
          <Combobox.InputGroup>
            <Combobox.Input placeholder="Search teams" aria-label="Disabled team search" />
            <Combobox.Trigger aria-label="Show disabled team list" />
          </Combobox.InputGroup>
        </Combobox.Root>
      </Field.Root>
      <Field.Root invalid>
        <Field.Label>Invalid</Field.Label>
        <Combobox.Root items={teams}>
          <Combobox.InputGroup>
            <Combobox.Input placeholder="Search teams" aria-label="Invalid team search" />
            <Combobox.Trigger aria-label="Show team list" />
          </Combobox.InputGroup>
          <Combobox.Content>
            <Combobox.List>
              {(team: string) => (
                <Combobox.Item key={team} value={team}>
                  {team}
                </Combobox.Item>
              )}
            </Combobox.List>
          </Combobox.Content>
        </Combobox.Root>
        <Field.Error>Select a supported team.</Field.Error>
      </Field.Root>
    </Grid>
  );
}
```

## Controlled selection

Use `value` and `onValueChange` when selection belongs to application state. `defaultValue` provides the uncontrolled equivalent.

```tsx
import { Combobox, Field, Stack, Text } from "@zentara-co/zenos-ui";
import { useState } from "react";

const teams = ["Design", "Engineering", "Operations"];

function ComboboxControlledExample() {
  const [team, setTeam] = useState<string | null>("Engineering");

  return (
    <Stack gap="3" className="w-full max-w-sm">
      <Field.Root id="controlled-team">
        <Field.Label>Workspace team</Field.Label>
        <Combobox.Root items={teams} value={team} onValueChange={setTeam}>
          <Combobox.InputGroup>
            <Combobox.Input placeholder="Search teams" />
            <Combobox.Clear aria-label="Clear team" />
            <Combobox.Trigger aria-label="Show teams" />
          </Combobox.InputGroup>
          <Combobox.Content>
            <Combobox.Empty>No teams found.</Combobox.Empty>
            <Combobox.List>
              {(item: string) => (
                <Combobox.Item key={item} value={item}>
                  {item}
                </Combobox.Item>
              )}
            </Combobox.List>
          </Combobox.Content>
        </Combobox.Root>
      </Field.Root>
      <Text className="text-sm text-text-subtle" aria-live="polite">
        Selected team: {team ?? "None"}
      </Text>
    </Stack>
  );
}
```

## Motion

`Combobox.Content` uses the fast popup motion rhythm: it fades, scales, and moves from the resolved placement on open, then reverses on close. Reduced-motion preferences remove the animation automatically.

Open both fields. The first popup animates in and out. `disableMotion` makes the second appear and disappear immediately.

```tsx
import { Combobox, Field, Grid } from "@zentara-co/zenos-ui";

const teams = ["Design", "Engineering", "Operations"];

function ComboboxMotionExample() {
  return (
    <Grid columns={{ base: 1, md: 2 }} gap="4" className="w-full">
      <Field.Root>
        <Field.Label>With motion</Field.Label>
        <Combobox.Root items={teams}>
          <Combobox.InputGroup>
            <Combobox.Input aria-label="Team with motion" placeholder="Search teams" />
            <Combobox.Trigger aria-label="Show teams with motion" />
          </Combobox.InputGroup>
          <Combobox.Content>
            <Combobox.Empty>No teams found.</Combobox.Empty>
            <Combobox.List>
              {(team: string) => (
                <Combobox.Item key={team} value={team}>
                  {team}
                </Combobox.Item>
              )}
            </Combobox.List>
          </Combobox.Content>
        </Combobox.Root>
      </Field.Root>
      <Field.Root>
        <Field.Label>Without motion</Field.Label>
        <Combobox.Root items={teams}>
          <Combobox.InputGroup>
            <Combobox.Input aria-label="Team without motion" placeholder="Search teams" />
            <Combobox.Trigger aria-label="Show teams without motion" />
          </Combobox.InputGroup>
          <Combobox.Content disableMotion>
            <Combobox.Empty>No teams found.</Combobox.Empty>
            <Combobox.List>
              {(team: string) => (
                <Combobox.Item key={team} value={team}>
                  {team}
                </Combobox.Item>
              )}
            </Combobox.List>
          </Combobox.Content>
        </Combobox.Root>
      </Field.Root>
    </Grid>
  );
}
```

## Multiple selection

Multiple selection uses chips to keep chosen values visible and individually removable while the input remains searchable.

```tsx
import { Combobox, Field, Stack, Text } from "@zentara-co/zenos-ui";
import { useState } from "react";

const teams = ["Design", "Engineering", "Operations"];

function ComboboxMultipleExample() {
  const [selectedTeams, setSelectedTeams] = useState<string[]>(["Design", "Engineering"]);

  return (
    <Stack gap="3" className="w-full max-w-lg">
      <Field.Root id="multiple-teams">
        <Field.Label>Project teams</Field.Label>
        <Combobox.Root
          items={teams}
          multiple
          value={selectedTeams}
          onValueChange={setSelectedTeams}
        >
          <Combobox.InputGroup>
            <Combobox.Value>
              {(value: string[]) => (
                <Combobox.Chips aria-label="Selected teams">
                  {value.map((team) => (
                    <Combobox.Chip key={team} aria-label={team}>
                      {team}
                      <Combobox.ChipRemove aria-label={`Remove ${team}`} />
                    </Combobox.Chip>
                  ))}
                  <Combobox.Input placeholder={value.length ? "Add team" : "Search teams"} />
                </Combobox.Chips>
              )}
            </Combobox.Value>
            <Combobox.Clear aria-label="Clear selected teams" />
            <Combobox.Trigger aria-label="Show teams" />
          </Combobox.InputGroup>
          <Combobox.Content>
            <Combobox.Empty>No teams found.</Combobox.Empty>
            <Combobox.List>
              {(team: string) => (
                <Combobox.Item key={team} value={team}>
                  {team}
                </Combobox.Item>
              )}
            </Combobox.List>
          </Combobox.Content>
        </Combobox.Root>
      </Field.Root>
      <Text className="text-sm text-text-subtle" aria-live="polite">
        {selectedTeams.length} teams selected
      </Text>
    </Stack>
  );
}
```

## Async search (single)

Load results when the input changes instead of fetching the entire collection upfront. Keep search text (`inputValue`) separate from selection (`value`), and use `filter={null}` when the server already filters results—including matches on email addresses or roles rather than just display names.

This example waits 250 ms before starting a simulated request, cancels superseded requests with `AbortController`, and ignores aborted responses. It searches only while the popup is open and the query has at least two characters. Loading, errors, and empty results are announced with `Combobox.Status`; requests never run just because a selected person's name fills the input.

```tsx
import { useEffect, useState } from "react";
import { Combobox, Field, Text } from "@zentara-co/zenos-ui";

interface DirectoryPerson {
  id: string;
  name: string;
  email: string;
  role: string;
}

const directoryPeople: DirectoryPerson[] = [
  { id: "ana", name: "Ana Santos", email: "ana@example.com", role: "Product Designer" },
  { id: "nadia", name: "Nadia Putri", email: "nadia@example.com", role: "Design Engineer" },
  { id: "leo", name: "Leo Chen", email: "leo@example.com", role: "Frontend Engineer" },
  { id: "maya", name: "Maya Patel", email: "maya@example.com", role: "Engineering Manager" },
  { id: "omar", name: "Omar Hassan", email: "omar@example.com", role: "Product Manager" },
  { id: "sari", name: "Sari Wijaya", email: "sari@example.com", role: "Researcher" },
];

function searchDirectory(query: string, signal: AbortSignal): Promise<DirectoryPerson[]> {
  return new Promise((resolve, reject) => {
    if (signal.aborted) {
      reject(new DOMException("Search cancelled", "AbortError"));
      return;
    }
    const timer = setTimeout(() => {
      signal.removeEventListener("abort", cancel);
      if (query === "error") {
        reject(new Error("Directory unavailable. Change your search to try again."));
        return;
      }
      resolve(
        directoryPeople
          .filter((person) =>
            `${person.name} ${person.email} ${person.role}`.toLowerCase().includes(query),
          )
          .map((person) => ({ ...person })),
      );
    }, 500);
    function cancel() {
      clearTimeout(timer);
      reject(new DOMException("Search cancelled", "AbortError"));
    }
    signal.addEventListener("abort", cancel, { once: true });
  });
}

interface DirectorySearchState {
  query: string;
  status: "idle" | "loading" | "success" | "error";
  results: DirectoryPerson[];
  error: string | null;
}

function useDirectorySearch(inputValue: string, enabled: boolean) {
  const query = inputValue.trim().toLowerCase();
  const canSearch = enabled && query.length >= 2;
  const [state, setState] = useState<DirectorySearchState>({
    query: "",
    status: "idle",
    results: [],
    error: null,
  });

  useEffect(() => {
    if (!canSearch) return;
    const controller = new AbortController();
    setState({ query, status: "loading", results: [], error: null });
    const timer = setTimeout(async () => {
      try {
        const results = await searchDirectory(query, controller.signal);
        if (!controller.signal.aborted) {
          setState({ query, status: "success", results, error: null });
        }
      } catch (error) {
        if (!controller.signal.aborted) {
          setState({
            query,
            status: "error",
            results: [],
            error: error instanceof Error ? error.message : "Could not search the directory.",
          });
        }
      }
    }, 250);
    return () => {
      clearTimeout(timer);
      controller.abort();
    };
  }, [query, canSearch]);

  const current: DirectorySearchState = !canSearch
    ? { query, status: "idle", results: [], error: null }
    : state.query === query
      ? state
      : { query, status: "loading", results: [], error: null };
  const message =
    current.status === "loading"
      ? "Searching directory…"
      : current.status === "error"
        ? current.error
        : current.status === "idle"
          ? "Type at least two characters to search."
          : current.results.length === 0
            ? `No people found for “${inputValue.trim()}”.`
            : `${current.results.length} ${current.results.length === 1 ? "person" : "people"} found.`;
  return { ...current, message, isLoading: current.status === "loading" };
}

function includeSelectedPeople(results: DirectoryPerson[], selected: DirectoryPerson[]) {
  return [
    ...results,
    ...selected.filter((person) => !results.some((result) => result.id === person.id)),
  ];
}

function DirectorySearchContent({ search }: { search: ReturnType<typeof useDirectorySearch> }) {
  return (
    <Combobox.Content aria-busy={search.isLoading || undefined}>
      <Combobox.Status>{search.message}</Combobox.Status>
      {search.status === "success" && search.results.length === 0 ? (
        <Combobox.Empty>Try a name, email address, or role.</Combobox.Empty>
      ) : null}
      <Combobox.List aria-label="Directory results">
        {(person: DirectoryPerson) => (
          <Combobox.Item key={person.id} value={person}>
            <span className="flex min-w-0 flex-col">
              <span>{person.name}</span>
              <span className="type-body-s text-text-subtle">
                {person.role} · {person.email}
              </span>
            </span>
          </Combobox.Item>
        )}
      </Combobox.List>
    </Combobox.Content>
  );
}

function ComboboxAsyncSingleExample() {
  const [selected, setSelected] = useState<DirectoryPerson | null>(null);
  const [inputValue, setInputValue] = useState("");
  const [open, setOpen] = useState(false);
  const search = useDirectorySearch(inputValue, open && inputValue !== selected?.name);
  const items = includeSelectedPeople(search.results, selected ? [selected] : []);

  return (
    <form
      className="flex w-full max-w-lg flex-col gap-3"
      onSubmit={(event) => event.preventDefault()}
    >
      <Field.Root>
        <Field.Label>Assign reviewer</Field.Label>
        <Combobox.Root
          name="reviewer"
          items={items}
          filter={null}
          value={selected}
          inputValue={inputValue}
          open={open}
          onOpenChange={setOpen}
          onInputValueChange={setInputValue}
          onValueChange={(person) => {
            setSelected(person);
            setInputValue(person?.name ?? "");
          }}
          itemToStringLabel={(person) => person.name}
          itemToStringValue={(person) => person.id}
          isItemEqualToValue={(item, value) => item.id === value.id}
        >
          <Combobox.InputGroup>
            <Combobox.Input
              placeholder="Search by name, email, or role"
              aria-busy={search.isLoading || undefined}
            />
            <Combobox.Clear aria-label="Clear reviewer" />
            <Combobox.Trigger aria-label="Search reviewers" />
          </Combobox.InputGroup>
          <DirectorySearchContent search={search} />
        </Combobox.Root>
        <Field.Description>
          Simulated remote directory. Type “error” to preview a failed request.
        </Field.Description>
      </Field.Root>
      <Text size="s" color="subtle" aria-live="polite">
        Selected reviewer: {selected?.name ?? "None"}
      </Text>
    </form>
  );
}
```

Replace `searchDirectory` with your application's API call, passing its signal to `fetch`. Keep the selected object in `items`, use `itemToStringLabel` for its display name, `itemToStringValue` for native form submission, and `isItemEqualToValue` to compare stable IDs across new responses. Fetching belongs to the consuming feature, not the core Combobox.

## Async search (multiple)

Add `multiple`, control selection as an array, and render removable chips through `Combobox.Value`. Merge selected people into each new result collection without duplicate IDs so changing the query, loading another result set, or encountering an error does not discard earlier selections. Selecting a person clears the search text. Remove chips individually without losing the other selections; closing the popup also clears the multiple-select query through Base UI's normal input behavior.

```tsx
import { useEffect, useState } from "react";
import { Combobox, Field, Text } from "@zentara-co/zenos-ui";

interface DirectoryPerson {
  id: string;
  name: string;
  email: string;
  role: string;
}

const directoryPeople: DirectoryPerson[] = [
  { id: "ana", name: "Ana Santos", email: "ana@example.com", role: "Product Designer" },
  { id: "nadia", name: "Nadia Putri", email: "nadia@example.com", role: "Design Engineer" },
  { id: "leo", name: "Leo Chen", email: "leo@example.com", role: "Frontend Engineer" },
  { id: "maya", name: "Maya Patel", email: "maya@example.com", role: "Engineering Manager" },
  { id: "omar", name: "Omar Hassan", email: "omar@example.com", role: "Product Manager" },
  { id: "sari", name: "Sari Wijaya", email: "sari@example.com", role: "Researcher" },
];

function searchDirectory(query: string, signal: AbortSignal): Promise<DirectoryPerson[]> {
  return new Promise((resolve, reject) => {
    if (signal.aborted) {
      reject(new DOMException("Search cancelled", "AbortError"));
      return;
    }
    const timer = setTimeout(() => {
      signal.removeEventListener("abort", cancel);
      if (query === "error") {
        reject(new Error("Directory unavailable. Change your search to try again."));
        return;
      }
      resolve(
        directoryPeople
          .filter((person) =>
            `${person.name} ${person.email} ${person.role}`.toLowerCase().includes(query),
          )
          .map((person) => ({ ...person })),
      );
    }, 500);
    function cancel() {
      clearTimeout(timer);
      reject(new DOMException("Search cancelled", "AbortError"));
    }
    signal.addEventListener("abort", cancel, { once: true });
  });
}

interface DirectorySearchState {
  query: string;
  status: "idle" | "loading" | "success" | "error";
  results: DirectoryPerson[];
  error: string | null;
}

function useDirectorySearch(inputValue: string, enabled: boolean) {
  const query = inputValue.trim().toLowerCase();
  const canSearch = enabled && query.length >= 2;
  const [state, setState] = useState<DirectorySearchState>({
    query: "",
    status: "idle",
    results: [],
    error: null,
  });

  useEffect(() => {
    if (!canSearch) return;
    const controller = new AbortController();
    setState({ query, status: "loading", results: [], error: null });
    const timer = setTimeout(async () => {
      try {
        const results = await searchDirectory(query, controller.signal);
        if (!controller.signal.aborted) {
          setState({ query, status: "success", results, error: null });
        }
      } catch (error) {
        if (!controller.signal.aborted) {
          setState({
            query,
            status: "error",
            results: [],
            error: error instanceof Error ? error.message : "Could not search the directory.",
          });
        }
      }
    }, 250);
    return () => {
      clearTimeout(timer);
      controller.abort();
    };
  }, [query, canSearch]);

  const current: DirectorySearchState = !canSearch
    ? { query, status: "idle", results: [], error: null }
    : state.query === query
      ? state
      : { query, status: "loading", results: [], error: null };
  const message =
    current.status === "loading"
      ? "Searching directory…"
      : current.status === "error"
        ? current.error
        : current.status === "idle"
          ? "Type at least two characters to search."
          : current.results.length === 0
            ? `No people found for “${inputValue.trim()}”.`
            : `${current.results.length} ${current.results.length === 1 ? "person" : "people"} found.`;
  return { ...current, message, isLoading: current.status === "loading" };
}

function includeSelectedPeople(results: DirectoryPerson[], selected: DirectoryPerson[]) {
  return [
    ...results,
    ...selected.filter((person) => !results.some((result) => result.id === person.id)),
  ];
}

function DirectorySearchContent({ search }: { search: ReturnType<typeof useDirectorySearch> }) {
  return (
    <Combobox.Content aria-busy={search.isLoading || undefined}>
      <Combobox.Status>{search.message}</Combobox.Status>
      {search.status === "success" && search.results.length === 0 ? (
        <Combobox.Empty>Try a name, email address, or role.</Combobox.Empty>
      ) : null}
      <Combobox.List aria-label="Directory results">
        {(person: DirectoryPerson) => (
          <Combobox.Item key={person.id} value={person}>
            <span className="flex min-w-0 flex-col">
              <span>{person.name}</span>
              <span className="type-body-s text-text-subtle">
                {person.role} · {person.email}
              </span>
            </span>
          </Combobox.Item>
        )}
      </Combobox.List>
    </Combobox.Content>
  );
}

function ComboboxAsyncMultipleExample() {
  const [selected, setSelected] = useState<DirectoryPerson[]>([]);
  const [inputValue, setInputValue] = useState("");
  const [open, setOpen] = useState(false);
  const search = useDirectorySearch(inputValue, open);
  const items = includeSelectedPeople(search.results, selected);

  return (
    <form
      className="flex w-full max-w-lg flex-col gap-3"
      onSubmit={(event) => event.preventDefault()}
    >
      <Field.Root>
        <Field.Label>Assign reviewers</Field.Label>
        <Combobox.Root
          name="reviewers"
          multiple
          items={items}
          filter={null}
          value={selected}
          inputValue={inputValue}
          open={open}
          onOpenChange={setOpen}
          onInputValueChange={setInputValue}
          onValueChange={(people, { reason }) => {
            setSelected(people);
            if (reason === "item-press" || reason === "clear-press") setInputValue("");
          }}
          itemToStringLabel={(person) => person.name}
          itemToStringValue={(person) => person.id}
          isItemEqualToValue={(item, value) => item.id === value.id}
        >
          <Combobox.InputGroup className="h-auto min-h-10">
            <Combobox.Value>
              {(people: DirectoryPerson[]) => (
                <Combobox.Chips aria-label="Selected reviewers">
                  {people.map((person) => (
                    <Combobox.Chip key={person.id} aria-label={person.name}>
                      {person.name}
                      <Combobox.ChipRemove aria-label={`Remove ${person.name}`} />
                    </Combobox.Chip>
                  ))}
                  <Combobox.Input
                    placeholder={people.length ? "Add reviewer" : "Search people"}
                    className="min-w-32 basis-32"
                    aria-busy={search.isLoading || undefined}
                  />
                </Combobox.Chips>
              )}
            </Combobox.Value>
            <Combobox.Clear aria-label="Clear reviewers" />
            <Combobox.Trigger aria-label="Search more reviewers" />
          </Combobox.InputGroup>
          <DirectorySearchContent search={search} />
        </Combobox.Root>
        <Field.Description>
          Search by name, email, or role. Selected reviewers remain available across searches.
        </Field.Description>
      </Field.Root>
      <Text size="s" color="subtle" aria-live="polite">
        Selected reviewers:{" "}
        {selected.length ? selected.map((person) => person.name).join(", ") : "None"}
      </Text>
    </form>
  );
}
```

Both examples use a deterministic, simulated directory rather than a live service. Search for a name such as “Ana”, a role such as “engineer”, an unknown name for an empty response, or “error” for a failed request. Change the query to recover. Clearing the input, closing the popup, and unmounting cancel pending work; `aria-busy` marks the input and popup while loading.

## Groups, status, and disabled items

Group related results, expose filtering status, and leave unavailable values visible when that context helps users understand the collection.

```tsx
import { Combobox } from "@zentara-co/zenos-ui";

function ComboboxGroupedExample() {
  const items = ["Design", "Engineering", "Operations", "Legacy systems"];

  return (
    <div className="w-full max-w-sm">
      <Combobox.Root items={items}>
        <Combobox.InputGroup variant="filled">
          <Combobox.Input aria-label="Capability" placeholder="Search capabilities" />
          <Combobox.Trigger aria-label="Show capabilities" />
        </Combobox.InputGroup>
        <Combobox.Content align="center" side="bottom">
          <Combobox.Status />
          <Combobox.Empty>No capabilities found.</Combobox.Empty>
          <Combobox.List>
            <Combobox.Group>
              <Combobox.GroupLabel>Active teams</Combobox.GroupLabel>
              {items.slice(0, 3).map((item) => (
                <Combobox.Item key={item} value={item}>
                  {item}
                </Combobox.Item>
              ))}
            </Combobox.Group>
            <Combobox.Separator />
            <Combobox.Item value="Legacy systems" disabled>
              Legacy systems
            </Combobox.Item>
          </Combobox.List>
        </Combobox.Content>
      </Combobox.Root>
    </div>
  );
}
```

## Anatomy

```text
Combobox.Root
Combobox.Trigger
Combobox.Value
Combobox.Content
Combobox.Input
Combobox.List
Combobox.Item
Combobox.Empty
Combobox.Group
Combobox.GroupLabel
Combobox.Separator
Combobox.Status
Combobox.Chips
Combobox.Chip
Combobox.ChipRemove
```

## API

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| value | ItemValue \| ItemValue[] \| null | — | Controlled selection. |
| defaultValue | ItemValue \| ItemValue[] | — | Initial uncontrolled selection. |
| onValueChange | (value) => void | — | Runs when selection changes. |
| multiple | boolean | false | Enables multiple selection. |
| items | ItemValue[] | — | Items available for filtering. |
| inputValue / onInputValueChange | string / (value, details) => void | — | Controls search text independently of selection. Use input changes to load async results in the consuming feature. |
| filter | function \| null | — | Set to null to disable local filtering when a remote service already filters results. |
| itemToStringLabel / itemToStringValue | (item) => string | — | Maps object values to display labels and native form values respectively. |
| isItemEqualToValue | (item, value) => boolean | — | Compares stable IDs so refreshed async objects retain their selected state. |
| disabled | boolean | false | Disables selection and input interaction. |
| name | string | — | Name used for native form submission. |
| open / defaultOpen / onOpenChange | controlled state props | — | Controls popup visibility. |
| size (InputGroup / Input / Trigger) | 'sm' \| 'md' \| 'lg' | md | Control height for the input group shell and nested input. |
| variant (InputGroup / Trigger) | 'default' \| 'filled' \| 'none' | default | Input group or standalone trigger surface treatment. |
| side / align (Content) | Base UI position values | bottom / start | Popup placement relative to its anchor. |
| Content.disableMotion | boolean | false | Disables the popup enter and exit animation for this instance. |

Unless narrowed above, each DOM-rendering part also accepts its underlying native or Base UI props, including className, style, aria-*, and data-*.

## Accessibility

Give the input an accessible label through `Field.Label`, `Combobox.Label`, or `aria-label`. Base UI manages the input's active descendant, listbox relationship, selection announcements, and focus. Arrow keys move through results, Enter selects the active result, Escape closes the popup without losing input focus, and removable chips expose named buttons.

Source: https://zenos-ui.pages.dev/components/combobox/