Skip to content

Combobox ​

A Combobox is a text input with a dropdown menu of selectable options.

NameValue
Props
status
disabled
View
Reading direction

Overview ​

When to use Combobox ​

Use the Combobox component when it's difficult to predict the user's response to a prompt. It provides predefined input values as options, for example common responses, to make it easier to complete the field.

If users can only select a predefined option, use Select (for a short list of options) or Lookup (for a longer, searchable list).

About Combobox ​

Combobox allows users to either input text or select a value from a menu of options to complete a form field. Combobox includes the following elements.

Start icon (optional) ​

A start icon can be included to visually enhance the Combobox's purpose.

  • Use a simple icon that is easily understandable to users.

Input ​

The user can type text into the TextInput. If they select an item from the menu, it will appear in the TextInput.

Placeholder text (optional) ​

Placeholder text provides an example of what type of information is being requested in the input.

  • Placeholder text should further illustrate and support the Combobox's label.
  • Placeholder text should never replace the label nor be the input's only description.

When the Combobox is expanded, a Menu of options is displayed. These options can use all the features of the MenuItem component.

  • 2–5 menu items are recommended for optimal usability.
  • When there are more items, consider setting a visible item limit to enable scrolling.

Examples ​

Basic Usage ​

The Combobox component combines a menu of selectable items with a text box that can accept arbitrary input from the user.

Developer notes

The component should receive a v-model:selected binding from its parent as well as an array of menuItems (which can be empty).

With configurable scroll ​

By default, all menu items are displayed when the menu is expanded. You can configure a visibleItemLimit to limit the height of the menu and enable scrolling.

Developer notes

To limit the height of the menu and enable scrolling, use the visibleItemLimit property of the menuConfig prop.

With filtering ​

When there are many options, you can filter items depending on the current input.

  • Include a "no results" message when no matching items are found.

Developer notes

Add a "no results" message via the no-results slot. If populated, this slot will automatically display when there are zero menu items.

Form field ​

A Combobox can be wrapped in the Field component to add features like a semantic label, description and help text, validation messages, and more. Refer to the Field page for more information.

What kind of data does the function accept?

Other features ​

The Combobox component has an internal TextInput and Menu. You can use the following features from those components in the Combobox component:

Technical implementation ​

Vue usage ​

TextInput props apply

This component contains a TextInput component. You can bind TextInput props to this component and they will be passed to the TextInput within.

Attributes passed to input

This component will pass any HTML attributes applied to it, except for CSS class, to the <input> element within the component.

Props ​

Prop nameDescriptionTypeDefault
menuItems(required)Menu items and/or menu group definitions.

Menu groups and individual menu items will be output in the order they appear here.
(MenuItemData|MenuGroupData)[]
selected(required)Value of the current selection.

Must be bound with v-model:selected.
string|number
disabledWhether the dropdown is disabled.booleanfalse
menuConfigConfiguration for various menu features. All properties default to false.

See the MenuConfig type.
MenuConfig{}
statusstatus property of the TextInput componentValidationStatusType'default'

Events ​

Event namePropertiesDescription
inputevent InputEventWhen the input value changes via direct use of the input
changeevent EventWhen an input value change is committed by the user (e.g. on blur)
load-moreWhen the user scrolls towards the bottom of the menu.

If it is possible to add or load more menu items, then now would be a good moment so that the user can experience infinite scrolling.
update:selectedselected string|number - The new selected valueWhen the selected value changes.
focusevent FocusEventWhen the input comes into focus
blurevent FocusEventWhen the input loses focus

Slots ​

NameDescriptionBindings
menu-itemDisplay of an individual item in the menumenu-item MenuItemData - The current menu item
no-resultsMessage to show if there are no menu items to display.

Keyboard navigation ​

KeyFunction
TabIt places the focus within the input of the Combobox and opens its menu. It also moves the focus to the next interactive element in tab order.
Shift + TabWhen the focus is placed within the Combobox input, it moves the focus to the previous interactive element.
Down arrowWhen the Combobox is focused, it opens the menu. When the menu is open, it navigates through menu options. If pressed at the last visible option, it scrolls to the next "hidden" menu item.
Up arrowWhen the Combobox is focused, it opens the menu. When the menu is open, it navigates through menu options.
EnterIt opens the menu when the focus is placed on the Combobox. If the menu is open, it closes the menu. If the focus is placed in any of the options within the menu, the focused option is selected.
EscWhen the menu it’s open, it closes the menu.
HomeOptionally, it moves the focus to the first option. Optionally, in a single-select listbox, selection may also move with focus. Supporting this key is strongly recommended for lists with more than five options.
EndOptionally, it moves the focus to the last option. Optionally, in a single-select listbox, selection may also move with focus. Supporting this key is strongly recommended for lists with more than five options.