Forms
ICombobox
A select you can type into. It takes the same items as ISelect and filters them against the query. The field shows the selected option's label; the model holds its value.
A plain string is expanded to { label: value, value }, so a list of names needs no shaping.
Groups
An entry with its own items becomes a labelled run of options. A group disappears once nothing inside it matches — type cir and watch "Recent" go.
Sizes
Empty results
emptyText is the line shown when the query matches nothing. The empty slot replaces that markup entirely and receives the current query.
Create from the query
Set create to offer a row for whatever was typed when nothing matches. Choosing it emits create with the trimmed query and leaves the model alone — add the option and select it yourself.
Virtualized rows
For lists in the thousands, virtual renders only the rows on screen. The field below holds 5,000 options.
virtual cannot be combined with grouped items: groups are flattened and their labels dropped, with a warning in dev. estimateSize is the assumed row height in px, used to size the scrollbar before the rows are measured — set it when you have restyled rows to a different height.
Use virtual for lists in the thousands.
Invalid
Inside an IFormField the field passes its own validity down, so invalid rarely needs setting by hand.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
items | (ComboboxItemOption | ComboboxItemGroup | string)[] | — | Options to render |
placeholder | string | — | Shown while the field is empty |
size | 'sm' | 'md' | 'lg' | 'md' | Control scale |
invalid | boolean | — | Red border and ring; inherited from IFormField when unset |
id | string | — | Id for the input; IFormField supplies one |
emptyText | string | 'No results found.' | Line shown when nothing matches |
create | boolean | — | Offer a "create" row for an unmatched query |
createLabel | (query: string) => string | Create "…" | Label for that row |
virtual | boolean | — | Render only the rows in view; flattens groups |
estimateSize | number | 32 | Assumed row height in px, before rows are measured |
overscan | number | 12 | Rows rendered beyond the viewport on each side |
unstyled | boolean | — | Drop built-in classes |
class | string | — | Merged with the built-in classes |
ui | { anchor?, input?, trigger?, content?, viewport?, item?, empty?, group?, groupLabel? } | — | Per-slot class overrides |
disabled, multiple, dir and the rest of Reka UI's ComboboxRoot props are forwarded.
Events
| Event | Payload | When |
|---|---|---|
create | query: string | The create row was chosen. The model is left alone |
Reka UI's own ComboboxRoot events are re-emitted unchanged.
Slots
| Slot | Props | When to use it |
|---|---|---|
empty | { query } | Replace the no-results line with your own markup |
create | { query } | Replace the create row's label with your own markup |
Item shapes
interface ComboboxItemOption {
label: string
value: string
disabled?: boolean
}
interface ComboboxItemGroup {
label: string
items: (ComboboxItemOption | string)[]
}Attributes you set land on the input, so aria-label and friends reach the control the reader types into.