# Combobox
> Searchable select with API-backed search, loading, and clear.
Import from `@aspyn-io/kit`. Scaffold source: `npx shadcn@latest add https://design.aspyn.io/r/combobox.json`
## Install
```tsx
import {
Combobox,
ComboboxInput,
ComboboxContent,
ComboboxEmpty,
ComboboxList,
ComboboxItem,
ComboboxGroup,
ComboboxLabel,
ComboboxCollection,
ComboboxSeparator,
ComboboxChips,
ComboboxChip,
ComboboxChipsInput,
ComboboxValue,
ComboboxTrigger,
useComboboxAnchor,
} from "@aspyn-io/kit";
```
### Single select
Pass items to the root; ComboboxList renders each as a ComboboxItem. Built-in filtering + empty state.
```tsx
No items found.
{(item) => {item}}
```
### Clearable
showClear adds a × button once something is selected.
```tsx
{/* … */}
```
### Multiple (chips)
Add `multiple`; render selected values as ComboboxChip inside ComboboxChips, anchored via useComboboxAnchor.
```tsx
const anchor = useComboboxAnchor();
{(values) => (
<>
{values.map((v) => {v})}
>
)}
{(item) => {item}}
```
### Grouped + separators
Group data as { value, items }; ComboboxGroup + ComboboxLabel + ComboboxCollection, with ComboboxSeparator between groups.
```tsx
{(group, index) => (
{group.value}
{(item) => {item}}
{index < groups.length - 1 && }
)}
```
### Custom item content
Object items with a title + description. Set itemToStringValue so typing filters by the label.
```tsx
c.label}>
{(country) => (
-
{country.label}
{country.continent}
)}
```
### Button trigger
Open from a Button (ComboboxTrigger render) with the selected value shown via ComboboxValue and the search moved inside the popup.
```tsx
}>
{(v) => v?.label ?? "Select a country"}
{(c) => {c.label}}
```
### Disabled & invalid
disabled and aria-invalid sit on ComboboxInput.
```tsx
```
## Notes
- Inherited from shadcn/ui — the Base UI Combobox (@base-ui/react): built-in filtering, keyboard highlight, item indicators, clear, grouping, and multi-select chips.
- ComboboxList takes a render-function child `(item) => `; grouped lists nest ComboboxCollection inside ComboboxGroup.
- For object items, pass itemToStringValue so typing filters by the display string; ComboboxItem value is the whole item.
- Controlled via value / onValueChange on the root (a single item for single-select, an array for multiple).