---
agent:
  instructions: "Search goop.so for Goop's components, templates, design skill, docs, pricing and terms. Ask in keywords or a plain question, such as \"date picker props\" or \"is the design skill free\"; the answer is the matching page sections in Markdown, each with its address."
  endpoint: "https://goop.so/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Combobox

Pick one value from a list by typing, for React and Tailwind CSS. Part of Goop Pro.

Pro. Its export: `Combobox`.

## Try it

In the fields look, type to filter the owners (an email finds its person too), pick with the arrows and Enter, clear with the cross (an owner is required: the field is refused while empty). Search a city: the list loads for a moment after each word, then shows what the server found. Type a topic the list lacks: it is offered first and kept as a new one. The beside look sets a city combobox over a select. The chips look is a create dialog’s row of property chips: Tab to one, Enter or a letter opens it round its own search, Enter picks and the focus comes back to the chip; the assignee may be none, the reviewer shows their avatar alone, and a label no row holds is created. Each look’s line under it names the list that is open.

The city search is a timer over twenty names of our own; a new topic or label lives in the page only.

## When to use

- Pick one value from a list by typing.
- Use it for one value from a list people know by name (a site, a person, a time); actions belong in a DropdownMenu. Its value is always one of its rows, unless `allowCustomValue` keeps a person's own words. A `className` places the root (width, margin, flex or grid place), never restyles the field or the list.
- Also called: autocomplete or typeahead.

## Installation

Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Combobox on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing. As a Pro part, its command comes from Goop's server once you sign in, with a one-time link that lasts ten minutes.

```sh
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-combobox.json --yes
```

```text
Add the Goop Combobox to this project. The install steps are at https://goop.so/docs/install.md
```

## Usage

```tsx
import { ComboboxGroup } from '@/components/ui/goop/combobox';

import { useState } from 'react';
import { Combobox, ComboboxContent, ComboboxInput, ComboboxItem } from '@/components/ui/goop/combobox';

function SitePicker({ onPick }: { onPick: (site: string) => void }) {
  const [site, setSite] = useState('');
  return (
    <Combobox
      value={site}
      onValueChange={(next) => {
        setSite(next);
        onPick(next);
      }}
      name="site"
    >
      <ComboboxInput aria-label="Field site" placeholder="Pick a site" />
      <ComboboxContent>
        <ComboboxItem value="north">North meadow</ComboboxItem>
        <ComboboxItem value="ridge" keywords={['R-7']}>
          Ridge path
        </ComboboxItem>
        <ComboboxItem value="marsh">Marsh edge</ComboboxItem>
      </ComboboxContent>
    </Combobox>
  );
}

function StartTime() {
  return (
    <Combobox variant="inline" defaultValue="09:00">
      <ComboboxInput aria-label="Start time" />
      <ComboboxContent>
        <ComboboxItem value="08:30">8:30 AM</ComboboxItem>
        <ComboboxItem value="09:00">9:00 AM</ComboboxItem>
        <ComboboxItem value="09:30">9:30 AM</ComboboxItem>
      </ComboboxContent>
    </Combobox>
  );
}
```

- Fits: flow, settings, record: field.
- Also known as: Autocomplete, Typeahead, SearchableSelect, Autosuggest.
- height, width, padding, gap, corner, border, background, shadow, text, motion: add no class for these.

## API reference

### Parts

- `ComboboxInput` — The field a person types into (`role="combobox"`); its props: combobox--input.md
- `ComboboxContent` — The open list (`role="listbox"`); its props: combobox--content.md
- `ComboboxItem` — One row of the list (`role="option"`); its props: combobox--item.md
- `ComboboxGroup` — A group of the list's rows under its `heading`, which names it (`role="group"`); its props: combobox--group.md

- data-slot values (to select a part by): combobox, combobox-clear, combobox-content, combobox-empty, combobox-error, combobox-group, combobox-group-heading, combobox-header, combobox-icon, combobox-input, combobox-item, combobox-item-indicator, combobox-item-label, combobox-item-mark, combobox-list, combobox-loading, combobox-search, combobox-trigger, combobox-trigger-media, combobox-trigger-words, combobox-wrapper

### ComboboxContent

The open list (`role="listbox"`).

```tsx
import { ComboboxContent } from '@/components/ui/goop/combobox';
```

### Options

- container?: HTMLElement | null — Where the panel is portalled; the end of `<body>` when left out.
- empty?: ReactNode = 'No results' — The words the list shows while no row matches; "No results" by default, `null` for none.
- loadingLabel?: string = 'Loading' — The words of the loading row, said as it appears; "Loading" by default.
- customLabel?: (words: string) => string — The row offering the words typed (`allowCustomValue`); `Use “<words>”` by default.
- noneRowLabel?: string — The row that sets an `optional` combobox back to none; "No <label>", else "Clear", by default.
- createLabel?: (words: string) => string — The row offering to create the words searched for (`onCreate`); `Create “<words>”` by default.
- creatingLabel?: (words: string) => string — The loading row while a create's promise waits; `Creating “<words>”` by default.
- searchPlaceholder?: string — The chip's search field's placeholder words (`shape="chip"`).
- searchLabel?: string — The chip's search field's name; the combobox's `label` by default, else `searchPlaceholder`.

### ComboboxGroup

A group of the list's rows under its `heading`, which names it (`role="group"`).

```tsx
import { ComboboxGroup } from '@/components/ui/goop/combobox';
```

### Options

- heading?: ReactNode — The group's heading words over its rows.

### ComboboxInput

The field a person types into (`role="combobox"`).

```tsx
import { ComboboxInput } from '@/components/ui/goop/combobox';
```

### Options

- clearable?: boolean = false — Shows the clear button while the field holds words or a chosen value; off by default.
- clearLabel?: string — The clear button's name; "Clear" and the field's own name by default.
- readOnly?: boolean = false — Shows the value without letting it change: focusable and copyable, no chevron, and nothing opens the list.
- Also takes: onChange?: (event: ChangeEvent<HTMLInputElement>) => void; name?: string; required?: boolean; disabled?: boolean; form?: string

### ComboboxItem

One row of the list (`role="option"`).

```tsx
import { ComboboxItem } from '@/components/ui/goop/combobox';
```

### Options

- value: string — The value it picks.
- keywords?: readonly string[] — More words the row is found by; its own words always are.
- disabled?: boolean = false — Keeps the row in the list, unpickable; off by default.
- icon?: IconName — The row's icon before its words, a pack icon by name.
- mark?: ReactNode — Your own element before the words, in place of `icon` (an avatar, a colour's dot); a chip shows the chosen one's.

### Combobox: every option

```tsx
import { Combobox } from '@/components/ui/goop/combobox';
```

### Options

- value?: string — The chosen row's value, `''` for none (controlled).
- defaultValue?: string = '' — The value chosen at first (uncontrolled); none by default.
- onValueChange?: (value: string) => void — Called with a row's value when it is picked, `''` when the field is cleared.
- inputValue?: string — The words in the field (controlled): what a person types, or the chosen row's words.
- defaultInputValue?: string — The words in the field at first (uncontrolled), searched as typed words are; the chosen row's words by default.
- onInputValueChange?: (words: string) => void — Called with the field's words as a person types (fetch your results here), and with the chosen row's words.
- open?: boolean — Whether the list is open (controlled).
- defaultOpen?: boolean = false — Whether the list is open at first (uncontrolled); closed by default.
- onOpenChange?: (open: boolean) => void — Called when the list opens or closes.
- filter?: boolean = true — Whether the list keeps only the rows whose words or `keywords` hold the words typed (accents and case aside); `false` when your code supplies the matching rows itself (a search on your server).
- loading?: boolean = false — Shows the loading row (the spinner and `ComboboxContent`'s `loadingLabel`) while your results are on their way.
- disabled?: boolean = false — Disables the field; off by default.
- name?: string — The name a form sends the value under (a hidden field); none by default.
- form?: string — The form the hidden field belongs to, by id, where the combobox is outside it.
- valueLabel?: string — The chosen value's words where no row of the list holds them; the row's own words otherwise.
- allowCustomValue?: boolean = false — Lets a person keep words no row says as the value (a tag, a new category): the list offers the words typed as its first row ("Use “…”", `ComboboxContent`'s `customLabel`), active, so Enter keeps them; a click on that row and leaving the field keep them too, trimmed.
- aria-invalid?: boolean | 'true' | 'false' — Marks the field invalid: its edge (filled) or its words (inline) in the danger colour.
- variant?: 'filled' | 'inline' = 'filled' — The field's look: `filled` (the default) the theme's text field with a chevron, as wide as its caller; `inline` the compact field with no fill or edge, 13 px muted words, as wide as its words, for a line of words.
- shape?: 'field' | 'chip' = 'field' — `field` (the default) the typed field (`ComboboxInput`); `chip` the 24 px property chip of a create dialog or a details row, drawn by the root itself (no `ComboboxInput`): the chosen row's `mark` and words, and while empty the property's `icon` and `label` in its dashed outline.
- label?: string — The chip's property, `Assignee`: its words while empty, the start of its name ("Assignee: Teodora Valk").
- icon?: IconName — The chip's icon where the chosen row has no mark (and while empty), by the pack's name.
- iconOnly?: boolean | 'narrow' = false — A chip as its icon alone: `true` always; `'narrow'` while its row, which must carry the class `@container/chip-row`, is under 672 px.
- noneLabel?: string = 'none' — The word the chip's name says while nothing is chosen ("Assignee: none").
- optional?: boolean = false — The value may be none: the list opens with a row ("No assignee", `noneRowLabel`) that sets it back to `''`.
- onCreate?: (words: string) => string | undefined | PromiseLike<string | undefined> — Makes a row from the words searched for when no row matches: the list offers "Create “…”" (`createLabel`), and Enter or a click calls this with the words, trimmed.
- State: value (value / defaultValue / onValueChange); inputValue (inputValue / defaultInputValue / onInputValueChange); open (open / defaultOpen / onOpenChange); drawn by data-focus-visible, data-state=open

## Keyboard

- typing: open the list, keep the matching rows, the first active
- ArrowDown: open the list (the chosen row active, else the first); move the active row down
- ArrowUp: open the list on its last row; move the active row up
- Enter: pick the active row and close
- Escape: close the list, the words typed kept
- Enter (closed, allowCustomValue): keep the words typed as the value
- Escape (closed, clearable): empty the field and the value
- Enter, Space, ArrowDown (chip): open the list round its search field, the focus in it
- a letter (chip): open the list searching for that letter
- Escape, Tab (chip's search): close the list, the focus back on the chip

## Accessibility

- The behaviour layer under the part answers keys, focus and dismissal: never write your own.
- hover: the browser's own (:hover): write nothing
- focus-visible: the attribute data-focus-visible
- open: the attribute data-state=open
- disabled: the prop disabled
- invalid: the attribute aria-invalid

## Motion

- The part sets its own motion: add no transition or animation of your own.

## Notes for AI

Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.

## Related

- [Multi select](/themes/meadow/components/multi-select): A field holding several values picked from a fixed list.
- [Person select](/themes/meadow/components/person-select): A person picker for an assignee, an owner, reviewers or guests, each person shown with their avatar beside their name.
- [Tags input](/themes/meadow/components/tags-input): A field a person types several short values into, each one a removable tag — labels, keywords, the emails to invite.
- [Slider](/themes/meadow/components/slider): A value or a span chosen by dragging a thumb along a track or with the keys, such as a recording's place, a volume or a price limit.
