# Combobox

> A searchable select with filtering and keywords.

- Category: [Inputs & forms](https://tarve.dev/docs.md#inputs)
- Import: `import { Combobox } from "@tarve/core";`
- Props type: `ComboboxProps`
- Source: [packages/core/src/popups.ts:501](https://github.com/omarcosr/tarve/blob/main/packages/core/src/popups.ts#L501)

## Usage

```tsx title="Combobox.tsx"
import { Combobox } from "@tarve/core";

let open = true;
let query = "";
let framework = "tarve";

<Combobox
  id="framework"
  open={open}
  query={query}
  value={framework}
  options={[
    { value: "tarve", label: "Tarve", keywords: ["native", "bun"] },
    { value: "electron", label: "Electron" },
    { value: "tauri", label: "Tauri" },
  ]}
  onOpenChange={(next) => {
    open = next;
  }}
  onQueryChange={(next) => {
    query = next;
  }}
  onValueChange={(value) => {
    framework = value;
  }}
/>
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `id` (required) | `string` | — |  |
| `open` (required) | `boolean` | — |  |
| `options` (required) | `readonly ComboboxOption[]` | — |  |
| `query` (required) | `string` | — |  |
| `contentStyle` | `Style` | — |  |
| `disabled` | `boolean` | `false` |  |
| `emptyText` | `string` | `"No results found."` |  |
| `onOpenChange` | `(open: boolean) => void` | — |  |
| `onQueryChange` | `(query: string) => void` | — |  |
| `onValueChange` | `(value: string) => void` | — |  |
| `placeholder` | `string` | `"Select an option"` |  |
| `searchPlaceholder` | `string` | `"Search..."` |  |
| `value` | `string` | — |  |

## Common props

Shared by every component (descriptions: https://tarve.dev/docs.md#common-props): `children`, `class`, `className`, `highlight`, `key`, `motionFrom`, `onHighlight`, `onPaste`, `onPointerLeave`, `onPointerMove`, `onSize`, `onTransitionEnd`, `rovingGroup`, `style`.

## Types

```ts title="ComboboxOption"
interface ComboboxOption {
  value: string;
  label: string;
  keywords?: readonly string[];
  disabled?: boolean;
}
```

Previous: [NativeSelect](https://tarve.dev/docs/components/NativeSelect.md) · Next: [Slider](https://tarve.dev/docs/components/Slider.md)

---

Tarve v0.13.8 · HTML version: https://tarve.dev/docs/components/Combobox · Index for agents: https://tarve.dev/llms.txt
