Overview
A combobox is a text input with a list of options. It filters the options as the user types, and keeps the focus on the input while the arrow keys move through the list.
Use it when a select would be too long to scan, or when users know the name of the option they want.
Installation
Install the package with your package manager, then import the components from it. The components work with server rendering.
The package has no peer dependencies other than React, and its styles come from the style recipes that you copy into your app.
Usage
Wrap the input and the popover in a provider. The provider holds the value and the open state, and the parts read them from it.
Each part renders one element, so you can put your own elements between them, such as a label above the input or a footer at the end of the popover.
Basic example
The simplest combobox filters a static list. Pass the matches to the popover and render an item for each one.
Typing opens the popover. Escape closes it and keeps the text in the input. The combobox component page lists every prop.
Controlled state
Pass the value and its setter to the provider to read the value while the user types, such as to load matches from a server.
The parts still change the value, and the provider tells you each change.
Styling
Every part renders one element and takes a class name. The open popover and the active item have attributes for their states.
The style recipes set the colors, the spacing, and the motion, and each one takes props for its variants.
The colors come from the surface around the combobox, so the same parts work on a light page, a dark page, and a colored card.