# Combobox

Autocomplete input and command palette with filtering and selection.

> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).





<ComponentPreview name="combobox-demo">
  <ComboboxBasic />
</ComponentPreview>

## Installation [#installation]

<Tabs defaultValue="cli">
  <TabsList>
    <TabsTrigger value="cli">
      CLI
    </TabsTrigger>

    <TabsTrigger value="manual">
      Manual
    </TabsTrigger>
  </TabsList>

  <TabsContent value="cli">
    ```bash
    npx shadcn@latest add https://shadcn-cssinjs.com/r/combobox.json
    ```
  </TabsContent>

  <TabsContent value="manual">
    <Steps>
      <Step>
        Install the following dependencies:
      </Step>

      ```bash
      pnpm add @base-ui/react @stylexjs/stylex
      ```

      <Step>
        Make sure [StyleX is configured](/docs/installation) and the design tokens are
        installed.
      </Step>

      <Step>
        Copy and paste the following code into your project.
      </Step>

      <ComponentSource name="combobox" title="combobox.tsx" />

      <Step>
        Update the import paths to match your project setup.
      </Step>
    </Steps>
  </TabsContent>
</Tabs>

## Usage [#usage]

```tsx
import {
  Combobox,
  ComboboxContent,
  ComboboxEmpty,
  ComboboxInput,
  ComboboxItem,
  ComboboxList,
} from "@/components/ui/combobox/combobox";
```

```tsx
<Combobox items={frameworks}>
  <ComboboxInput placeholder="Select a framework" />
  <ComboboxContent>
    <ComboboxEmpty>No items found.</ComboboxEmpty>
    <ComboboxList>
      {(item) => (
        <ComboboxItem key={item} value={item}>
          {item}
        </ComboboxItem>
      )}
    </ComboboxList>
  </ComboboxContent>
</Combobox>
```

## Examples [#examples]

### Basic [#basic]

<ComponentPreview name="combobox-demo">
  <ComboboxBasic />
</ComponentPreview>

### Groups [#groups]

<ComponentPreview name="combobox-groups">
  <ComboboxWithGroupsAndSeparator />
</ComponentPreview>

### Multiple [#multiple]

Use the `multiple` prop with `ComboboxChips` to select several items.

<ComponentPreview name="combobox-multiple">
  <ComboboxMultiple />
</ComponentPreview>

### Clear Button [#clear-button]

Use `showClear` on `ComboboxInput` to render a clear button.

<ComponentPreview name="combobox-clear">
  <ComboboxWithClear />
</ComponentPreview>

### Auto Highlight [#auto-highlight]

Use the `autoHighlight` prop to highlight the first matching item.

<ComponentPreview name="combobox-auto-highlight">
  <ComboboxAutoHighlight />
</ComponentPreview>

### Invalid [#invalid]

<ComponentPreview name="combobox-invalid">
  <ComboboxInvalid />
</ComponentPreview>

### Disabled [#disabled]

<ComponentPreview name="combobox-disabled">
  <ComboboxDisabled />
</ComponentPreview>

### Popup [#popup]

<ComponentPreview name="combobox-popup">
  <ComboboxPopup />
</ComponentPreview>



## RTL [#rtl]

To enable right-to-left support, see the [RTL guide](/docs/rtl).

<ComponentPreview name="combobox-rtl" direction="rtl">
  <ComboboxRtl />
</ComponentPreview>

## API Reference [#api-reference]

See the [Base UI Combobox](https://base-ui.com/react/components/combobox#api-reference)
documentation for the full API.
