Inputs
Combobox
Pick a suggestion or type your own
Value: —
When to use
- The user may type a new tag, address, name or other valid text.
- You need a list of options and filtering while typing.
When not to use
- You need a strictly closed vocabulary —
Select, including withsearchable. - You need to enter several tags —
TagInput.
Minimal example
<Combobox
aria-label="City"
items={[{ id: "msk", label: "Moscow" }]}
inputValue={city}
onInputChange={setCity}
allowsCustomValue
/>Public API
itemsis an array of{ id, label, meta? };metais shown in the right column.- The other supported props come from React Aria ComboBox: use controlled
inputValue/onInputChange, andselectedKey/onSelectionChangeonly when the scenario needs it. menuTriggerisfocusby default, so the list of options is visible on entering the field;notFoundTextconfigures the empty list.placeholderbelongs to the field,classNameto the root.
Accessibility and keyboard
- The hint and error of
FormFieldare announced together with the field. The description arrives through context, andaria-describedbyis set on the input; anaria-describedbypassed by the consumer is not overridden but extended with the form description. Before kit version 3.0.0 the react-aria components did not pick up the form description — it was on the screen but did not reach the screen reader (ADR-0031). - React Aria provides the combobox behavior, filtering and
aria-activedescendant. - Inside
DialogandDraweran option can be selected with the mouse. The list lives in a react-aria portal under<body>, where the Radix modal layer disables pointer events; the kit gives it back to the overlay with a rule in@olddevs/ui/styles.css. Before this fix an option could be selected only from the keyboard. - Provide an accessible name through
aria-labelor an associated label. - See
src/components/inputs/Combobox.tsx,src/components/inputs/Combobox.stories.tsx,tests/combobox.test.tsx.
TypeScript types
ComboboxProps
Prop
Type
Plus DOM attributes, such as onClick, id, aria-label — 76 in total; the table does not repeat them.