Combobox
An editable search input paired with a dropdown list that commits explicit option values.
Base Combobox pairs a single-line search input with a filterable option list. The selected option key (value) stays separate from the editable query text (inputValue), so unmatched text is never silently committed as an option.
Preview
Section titled “Preview” Web Components React Vue Vue 2
Loading interactive preview… The article and source are ready to read. Interactive controls will appear here when ready.
Installation
Section titled “Installation”Available starting in 0.3.0-rc.1 and later releases.
Anatomy
Section titled “Anatomy”Compose Root, Input, Content, Item, Empty, Trigger, plus optional grouping parts (Group, Label, Separator) and multi-value chip parts (Chips, Chip, ChipRemove):
Roottracks the selected item key (value/ multi-valuevalues), editable query (inputValue), and popup state (open).Groupbinds its localLabeland hides both visually and from the accessibility tree when no descendantItemmatches;Separatoris a decorative contentless divider.- With
multiple={true},Contentprojectsaria-multiselectable="true", selecting toggles membership while keeping the popup open, and pressingBackspaceon an empty input or activatingChipRemoveremoves the matching value and returns focus toInput. - Built-in filtering matches
textValueandkeywordscase- and diacritic-insensitively. Setfilter={false}to filter items in your application. Emptyreflects whether any items match; disabled and duplicate-valued options cannot be committed.
Controlled state and keyboard behavior
Section titled “Controlled state and keyboard behavior”value,inputValue, andopencan each be controlled independently via their change events.Inputretains focus during arrow-key navigation, and active IME composition never triggers selection.
Root Props
Section titled “Root Props”Pass value, inputValue, or open to control the corresponding state.
| Prop | Type | Default |
|---|---|---|
value | string | — |
defaultValue | string | '' |
multiple | boolean | false |
values | readonly string[] | — |
defaultValues | readonly string[] | [] |
inputValue | string | — |
defaultInputValue | string | '' |
open | boolean | — |
defaultOpen | boolean | false |
disabled | boolean | false |
readOnly | boolean | false |
filter | boolean | true |
loop | boolean | true |
a11yLabel | string | '' |
Other parts
Section titled “Other parts”- Input:
placeholder,a11yLabel, andnamedefault to''. - Content:
sidedefaults to'bottom',alignto'start',sideOffsetto4, andcollisionPaddingto8. - Item:
value,textValue, andkeywordsdefault to'';disableddefaults tofalse. - Empty: no props.
- Trigger:
disableddefaults tofalse. - Group / Label / Separator: no extra props;
Groupexposes avisiblestate. - Chips / Chip / ChipRemove:
Chipsacceptsa11yLabel;Chipacceptsvalueanddisabledand exposesselected,disabled, andremove();ChipRemoveacceptsa11yLabelanddisabled.