Vistaprint

Combobox

A Combobox combines a text input and a list of suggested (but not mandatory) values that appears when the user enters text into the text input. Combobox can be used to create features such as autocomplete, or to showcase popular choices.

Combobox is only available in the React API for Visage, not in the vanilla JS version.

Basic Combobox

For a typical Combobox, we provide a BasicCombobox convenience component.

It takes as children a set of ComboboxOption components, each of which needs a value prop. The value is what will be displayed in the popup of suggestions once the user starts typing.

If you want a suggestion to display the value plus some additional content (such as a Callout), you can give a ComboboxOption a child element of <ComboboxOptionText /> along with that additional content. This ComboboxOptionText child will display the actual value; the additional content will not be displayed inside the text input if the user picks this suggestion.

Share
Share
jsx

full Combobox

If you can't use the BasicCombobox convenience component, you can also use the API for the actual Combobox that underlies it.

This allows you to put additional content inside the "popover" sub-component, notably a ComboboxPopoverTitle above the ComboboxList.

Share
Share
jsx

Combobox with Thumbnails

The Combobox popup can also display square thumbnails for each of the suggestions. Instead of ComboboxOption, use ComboboxOptionWithThumbnail. Each ComboboxOptionWithThumbnail should have two children:

  • a ComboboxOptionThumbnailContainer holding a square FluidImage

  • a ComboboxOptionTextContainer holding the <ComboboxOptionText /> and any other content.

Share
Share
jsx

Components

Visage's Combobox is built on top of the reach-ui third-party component. See the Reach documentation for full prop descriptions.