Combobox: Controlled
Control the selection with value and onValueChange, and the popup with open and onOpenChange. Clearing sets the value to null.
Value: Peach
This adds the example as components/examples/combobox/controlled.tsx, together with the Combobox component and the HextaUI theme tokens it needs.
pnpm dlx shadcn@latest add https://hextaui.com/r/combobox-controlled.jsonTo add only the component, follow the Combobox installation.
Props in this example
The Combobox props this example sets, from the API reference.
| Prop | Type | Default |
|---|---|---|
itemsThe options. Filtered as you type and passed to the list’s render function. | Item[] | Group[] | – |
value | Value | Value[] | null | – |
onValueChange | (value, details) => void | – |
open | boolean | – |
onOpenChange | (open: boolean, details) => void | – |
| Prop | Type | Default |
|---|---|---|
showClearShow a clear button in the chevron’s place while there is a value. | boolean | false |
placeholder | string | – |
| Prop | Type | Default |
|---|---|---|
valueThe item this row represents. | Item | – |
Every prop is in the Combobox API reference.
- Clear button
- With icons
- Groups and separators
- Multiple
- Search inside the popup
- Trigger rendered as a Button
- Disabled, invalid and disabled items
- Long content and large lists
- Async search
- Inside a sheet
- Right to left
See them all, with keyboard support and accessibility notes, on the Combobox page.
- CalendarA date grid for single, range and multiple selection, with sliding months, range previews and touch-sized days.
- CheckboxA checkbox whose check draws in, with indeterminate parents, groups and labels that share its hover.
- Date pickerA button that opens a calendar in a popover, or a bottom sheet on phones, for single dates and ranges.
- FieldLabels, descriptions and errors wired to their control, with validation states and layouts for forms.
- InputA text input with three sizes, invalid and read-only states, native validation styling and a 16px touch font so phones never zoom in.
- Input groupAn input with icons, text, buttons or a keyboard hint attached, sharing one border and focus ring.