Skip to content

Multi Select Combobox ​

Combobox with different configuration options that also supports multi select.

Type: Building Block

Available in: App Page · Home Page · Record Page · Flow Screen

Read on Medium ​

How to Create the LWC Multi-Select Combobox that Salesforce is Still Missing

How to Create the LWC Multi-Select Combobox that Salesforce is Still Missing

Attributes ​

NameTypeDefaultDescription
disabledbooleanfalseIf present, the combobox is disabled and users cannot interact with it.
enable-searchbooleanfalseIf present, a search input is shown inside the dropdown to filter options by label.
labelstring''Text label for the combobox.
namestringSpecifies the name of the combobox.
optionsArray or string[]A list of options that are available for selection, as an array or a JSON string. Each option has a label and a value, and optionally selected.
placeholderstring'Select an Option'Text that is displayed before an option is selected, to prompt the user to select an option.
read-onlybooleanfalseIf present, the combobox is read-only. A read-only combobox is also disabled.
requiredbooleanfalseIf present, a value must be selected before a form can be submitted.
single-selectbooleanfalseIf present, the combobox only allows the selection of a single value.
show-pillsbooleanfalseIf present, the combobox will show a pill container with the currently selected options.
valuestringRead-only. The values of the selected options, separated by semicolons. Also available as a Flow output.
validatemethodChecks the required attribute for Flow screens. Returns isValid and errorMessage.

Usage ​

html
<c-multi-select-combobox
  label="Products"
  name="products"
  options={options}
  onchange={handleChange}
  show-pills
  enable-search
></c-multi-select-combobox>

Each option requires a label and a value. If a string is not valid JSON, the component shows an error message.

Keyboard ​

KeyAction
Down, Enter or SpaceOpens the list and moves to the selected or first option.
Up, DownMoves through the options and wraps around. Up also returns to the search.
Home, EndMoves to the first or last option.
Enter or Space on an optionSelects or deselects it.
EscapeCloses the list and returns to the combobox.
TabMoves on and closes the list.

Events ​

NameDetailDescription
changeThe selected options as an array, or a single option object if single-select is set.Fired when the selection changes.
close-Fired when the dropdown is closed.

Custom Labels ​

The texts users see are Custom Labels, so they can be translated in Setup with the Translation Workbench. Copy them together with the component.

NameValue
ErrorAlert_ErrorError
MultiSelectCombobox_ClickHereClick here
MultiSelectCombobox_InvalidOptionsThe options could not be displayed because they are not valid JSON.
MultiSelectCombobox_OpenDropdownClick to open the dropdown
MultiSelectCombobox_OptionsSelected{0} Options Selected
MultiSelectCombobox_Requiredrequired
MultiSelectCombobox_SearchSearch
MultiSelectCombobox_SearchPlaceholderSearch...
MultiSelectCombobox_SelectValuePlease select a value.
MultiSelectCombobox_SelectValueForPlease select a value for {0}.
MultiSelectComboboxItem_SelectedSelected

Component Dependencies ​

NameTypeDescription
labelUtilsLWCShared function to fill the placeholders of Custom Labels.
multiSelectComboboxItemLWCChild component that represents an item within the multiSelectCombobox parent component.
errorAlertLWCInline alert that shows error messages to the user.

Released under the MIT License. · llms.txt for AI agents