The combo lets the user select one or more options from a list. Unlike the select, it shows the options in a virtualized list, so the list can hold thousands of options. The combo supports custom item templates, case-sensitive filtering, grouping and binding to complex data.
- Slots
-
prefix— Renders content before the input of the combo. -
suffix— Renders content after the input of the combo. -
header— Renders a container before the list of options of the combo. -
footer— Renders a container after the list of options of the combo. In the confirm mode of `selectionCommit`, its default content is Cancel and Apply. -
empty— Renders content when the combo dropdown list has no items/data. -
loading— Renders content that replaces the default spinner while `loading` is set. It is in the input, so a click on it toggles the list, as on the toggle icon. -
helper-text— Renders content below the input of the combo. -
toggle-icon— Renders content that replaces the default toggle icon. -
clear-icon— Renders content that replaces the default clear icon. -
value-missing— Renders content when the required validation fails. -
custom-error— Renders content when setCustomValidity(message) is set. -
invalid— Renders content when the component is in invalid state (validity.valid = false).
- CSS Parts
-
label— The encapsulated text label of the combo. -
input— The main input field of the combo. -
native-input— The native input of the main input field of the combo. -
prefix— The prefix wrapper of the combo. -
suffix— The suffix wrapper of the combo. -
toggle-icon— The toggle icon wrapper of the combo. -
filled— Added to the toggle-icon part when the combo has a value. -
clear-icon— The clear icon wrapper of the combo. -
case-icon— The case icon wrapper of the combo. -
helper-text— The helper text wrapper of the combo. -
filter-input— The wrapper of the search input. -
search-input— The search input field of the combo. -
list-wrapper— The list of options wrapper of the combo. -
list— The list of options box of the combo. -
item— Each item in the list of options. -
group-header— Each group header in the list of options. -
active— Added to the item part when the item is active, to the group-header part when the header is an active option of `groupSelection`, and to the case-icon part while case-sensitive filtering is on. -
selected— Added to the item part when the item is selected, and to the group-header part of `groupSelection` when all the shown items of the group are selected. -
checkbox— The checkbox of each item in the list. -
checkbox-indicator— The checkbox indicator of each item in the list. -
checked— Added to the checkbox and checkbox-indicator parts when the checkbox is checked. -
indeterminate— Added to the checkbox and checkbox-indicator parts of the select-all option, or of a group header of `groupSelection`, while only some of its shown items are selected. -
select-all— Added to the item part of the select-all option. -
header— The container holding the header content of the combo. -
footer— The container holding the footer content of the combo. -
actions— The container of the Cancel and Apply buttons of the confirm mode. -
cancel-button— The Cancel button of the confirm mode. -
apply-button— The Apply button of the confirm mode. -
empty— The container holding the empty content of the combo. -
loading— The indeterminate circular progress that replaces the toggle icon while `loading` is set. It has the color of the text. -
placeholder— Added to the item part of each item to load, which `totalItemCount` adds. Its skeleton has the color of the text.
Properties
Section titled "Properties"autofocus
Section titled "autofocus"Whether the control takes the focus automatically.
autofocus: boolean autofocusList
Section titled "autofocusList"Whether the list of options, not the search input, takes the focus when the list opens. It has no effect in single selection mode.
autofocusList: boolean caseSensitiveIcon
Section titled "caseSensitiveIcon"Whether the search input shows the icon that toggles case-sensitive
filtering. In remote filtering mode, read filteringOptions.caseSensitive
when you send the search to the server.
caseSensitiveIcon: boolean The data source used to generate the list of options. A new data source keeps the selection, also the selected items that it does not hold.
data: T[] disableClear
Section titled "disableClear"Whether the clear button is hidden.
disableClear: boolean disableFiltering
Section titled "disableFiltering"Whether the filtering of the list of options is disabled. In multiple selection mode, it also hides the search input.
disableFiltering: boolean displayKey
Section titled "displayKey"The key in the data source used to display items in the list. Falls back
to valueKey.
displayKey: keyof T | undefined filteringOptions
Section titled "filteringOptions"An object that configures the filtering of the combo.
filteringOptions: FilteringOptions<T> groupHeaderTemplate
Section titled "groupHeaderTemplate"The template used for the content of each combo group header.
groupHeaderTemplate: ComboGroupHeaderTemplate<T> groupKey
Section titled "groupKey"The key in the data source used to group items in the list.
groupKey: string | keyof T | undefined groupSelection
Section titled "groupSelection"Whether a group header is an option that selects the items of its group
that the list shows, or deselects them when all of them are selected.
Only in multiple selection mode with groupKey.
groupSelection: boolean groupSorting
Section titled "groupSorting"The sort order of the groups, by their group value. With none, the
groups keep the order of the data source.
groupSorting: GroupingDirection itemTemplate
Section titled "itemTemplate"The template used for the content of each combo item.
itemTemplate: ComboItemTemplate<T> loading
Section titled "loading"Whether the combo loads options. A spinner, which the loading slot can
replace, then takes the place of the toggle icon, and an empty list shows
a loading message instead of the empty message.
loading: boolean outlined
Section titled "outlined"Whether the control has an outlined appearance.
outlined: boolean placeholder
Section titled "placeholder"The placeholder text of the control.
placeholder: string | undefined placeholderSearch
Section titled "placeholderSearch"The placeholder text of the search input.
placeholderSearch: string selectionCommit
Section titled "selectionCommit"When the user's changes of the selection apply in multiple selection
mode. With confirm, they change a pending selection while the list is
open, and Enter or the Apply button applies it with one igcChange. Any
other close drops it. While it exists, the selection methods change it too.
selectionCommit: ComboSelectionCommit showSelectAll
Section titled "showSelectAll"Whether the list starts with an option that selects all the items that it shows, or deselects them when all of them are selected. Only in multiple selection mode.
showSelectAll: boolean singleSelect
Section titled "singleSelect"Whether only one item can be selected. In this mode, the main input filters the list of options.
singleSelect: boolean totalItemCount
Section titled "totalItemCount"The number of all the items of a remote source, when the source knows it.
In remote filtering mode, the list shows a placeholder for each item that
data does not hold yet, so the scrollbar shows the full list.
totalItemCount: number | undefined value
Section titled "value"The values of the selected items. With a valueKey, each value is that
field of an item. Without it, each value is the item itself.
The value attribute takes a JSON array. For a data source of objects,
set valueKey to select items through the attribute.
value: ComboValue<T>[] valueKey
Section titled "valueKey"The key in the data source used when selecting items.
valueKey: keyof T | undefined Accessors
Section titled "Accessors"pendingValue
Section titled "pendingValue"The values of the pending selection in the confirm mode of
selectionCommit, which Enter, the Apply button or commitSelection()
applies. Without a pending selection, the same as value.
get pendingValue(): ComboValue<T>[]
Returns ComboValue<T>[]
selection
Section titled "selection"Returns the current selection as an array of objects as provided in the data source.
get selection(): T[]
Returns T[]
Methods
Section titled "Methods"Removes focus from the component.
blur(): void Returns void
cancelSelection
Section titled "cancelSelection"Puts value back as the pending selection of the confirm mode. It does
not close the list.
cancelSelection(): void Returns void
commitSelection
Section titled "commitSelection"Applies the pending selection of the confirm mode to value. It does not
emit igcChange or close the list.
commitSelection(): void Returns void
deselect
Section titled "deselect"Deselects options in the list by reference or by valueKey value. It
does not emit igcChange. Without an argument, it deselects all items.
deselect(items: Item<T> | Item<T>[]): void Parameters
- items:
Item<T> | Item<T>[]One or more items to deselect. Pass multiple items as an array. With a
valueKey, pass the value of an item instead of its reference.
Returns void
Example
const combo = document.querySelector('igc-combo')!;
// Deselect one item at a time by reference when valueKey is not specified.
combo.deselect(combo.data[0]);
// Deselect multiple items at a time by reference when valueKey is not specified.
combo.deselect([combo.data[0], combo.data[1]]);
// Deselect one item at a time when valueKey is specified.
combo.deselect('BG01');
// Deselect multiple items at a time when valueKey is specified.
combo.deselect(['BG01', 'BG02']); deselectAllItems
Section titled "deselectAllItems"Deselects all the items that the list shows. It does not emit igcChange.
deselectAllItems(ignoreFilter: boolean): void Parameters
- ignoreFilter:
booleanWhether to deselect all the items.
Returns void
focus
Section titled "focus"Sets focus on the component.
focus(options: FocusOptions): void Parameters
- options:
FocusOptions
Returns void
select
Section titled "select"Selects options in the list by reference or by valueKey value. It does
not emit igcChange. An object that data does not hold is selected as
it is. Without an argument, it selects all the items of data, or clears
the selection in single selection mode.
select(items: Item<T> | Item<T>[]): void Parameters
- items:
Item<T> | Item<T>[]One or more items to select. Pass multiple items as an array. With a
valueKey, pass the value of an item instead of its reference.
Returns void
Example
const combo = document.querySelector('igc-combo')!;
// Select one item at a time by reference when valueKey is not specified.
combo.select(combo.data[0]);
// Select multiple items at a time by reference when valueKey is not specified.
combo.select([combo.data[0], combo.data[1]]);
// Select one item at a time when valueKey is specified.
combo.select('BG01');
// Select multiple items at a time when valueKey is specified.
combo.select(['BG01', 'BG02']); selectAllItems
Section titled "selectAllItems"Selects all the items that the list shows. It does not emit igcChange,
and does nothing in single selection mode.
selectAllItems(ignoreFilter: boolean): void Parameters
- ignoreFilter:
booleanWhether to select all the items of
data.
Returns void
Events
Section titled "Events"onChange
Section titled "onChange"Emitted before the user changes the selection, or applies the pending selection of the confirm mode (
onChange(args: CustomEvent<IgrComboChangeEventArgs<any>>): void Parameters
- args:
CustomEvent<IgrComboChangeEventArgs<any>>
Returns void
onClosed
Section titled "onClosed"Emitted after the list of options closes on a user action. The
onClosed(args: CustomEvent<IgrComboClosingEventArgs>): void Parameters
Returns void
onClosing
Section titled "onClosing"Emitted before the user closes the list of options. Cancelable. The
onClosing(args: CustomEvent<IgrComboClosingEventArgs>): void Parameters
Returns void
onDataRequest
Section titled "onDataRequest"Emitted in remote filtering mode when the user scrolls near the end of the options, or to a placeholder of
onDataRequest(args: CustomEvent<VirtualScrollDataRequest>): void Parameters
Returns void
onOpened
Section titled "onOpened"Emitted after the list of options opens on a user action.
onOpened(args: CustomEvent<void>): void Parameters
- args:
CustomEvent<void>
Returns void
onOpening
Section titled "onOpening"Emitted before the user opens the list of options. Cancelable.
onOpening(args: CustomEvent<void>): void Parameters
- args:
CustomEvent<void>
Returns void
onPendingChange
Section titled "onPendingChange"Emitted in the confirm mode of
onPendingChange(args: CustomEvent<IgrComboChangeEventArgs<any>>): void Parameters
- args:
CustomEvent<IgrComboChangeEventArgs<any>>
Returns void
onSearchInput
Section titled "onSearchInput"Emitted when the user changes the text of the search input, or of the main input in single selection mode, and when a selection, a blur or the clear button clears the text. Also emitted with the same text when the case
onSearchInput(args: CustomEvent<IgrComboSearchInputEventArgs>): void