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.
- Element
-
igc-combo
- 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 Defined in src/components/combo/combo.ts:354
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 = false Defined in src/components/combo/combo.ts:363
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 = false Defined in src/components/combo/combo.ts:477
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[] = [] Defined in src/components/combo/combo.ts:316
disableClear
Section titled "disableClear"Whether the clear button is hidden.
disableClear: boolean = false Defined in src/components/combo/combo.ts:499
disabled
Section titled "disabled"Inherited from: I18nMixin( FormAssociatedRequiredMixin( EventEmitterMixin< IgcComboComponentEventMap, typeof IgcBaseComboBoxComponent >(IgcBaseComboBoxComponent) ), i18n )
Whether the control is disabled. A disabled control is not validated, and the form does not submit its value.
disabled: boolean Defined in src/internals/mixins/forms/types.ts:35
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 = false Defined in src/components/combo/combo.ts:491
groupHeaderTemplate
Section titled "groupHeaderTemplate"The template used for the content of each combo group header.
groupHeaderTemplate: ComboGroupHeaderTemplate<T> Defined in src/components/combo/combo.ts:566
Optional groupKey
Section titled "groupKey"The key in the data source used to group items in the list.
groupKey: string | keyof T Defined in src/components/combo/combo.ts:432
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 = false Defined in src/components/combo/combo.ts:538
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 = 'asc' Defined in src/components/combo/combo.ts:442
invalid
Section titled "invalid"Inherited from: I18nMixin( FormAssociatedRequiredMixin( EventEmitterMixin< IgcComboComponentEventMap, typeof IgcBaseComboBoxComponent >(IgcBaseComboBoxComponent) ), i18n )
Whether the control shows the invalid state. It changes only the visual state, not the validity.
invalid: boolean Defined in src/internals/mixins/forms/types.ts:43
itemTemplate
Section titled "itemTemplate"The template used for the content of each combo item.
itemTemplate: ComboItemTemplate<T> Defined in src/components/combo/combo.ts:557
Optional label
Section titled "label"The label of the control.
label: string Defined in src/components/combo/combo.ts:370
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 = false Defined in src/components/combo/combo.ts:518
Inherited from: I18nMixin( FormAssociatedRequiredMixin( EventEmitterMixin< IgcComboComponentEventMap, typeof IgcBaseComboBoxComponent >(IgcBaseComboBoxComponent) ), i18n )
The name of the control, submitted with the form data.
name: string Defined in src/internals/mixins/forms/types.ts:49
Inherited from: I18nMixin( FormAssociatedRequiredMixin( EventEmitterMixin< IgcComboComponentEventMap, typeof IgcBaseComboBoxComponent >(IgcBaseComboBoxComponent) ), i18n )
Whether the component is open.
open: boolean = false Defined in src/internals/bases/combo-box.ts:50
outlined
Section titled "outlined"Whether the control has an outlined appearance.
outlined: boolean = false Defined in src/components/combo/combo.ts:324
Optional placeholder
Section titled "placeholder"The placeholder text of the control.
placeholder: string Defined in src/components/combo/combo.ts:377
scrollStrategy
Section titled "scrollStrategy"Inherited from: I18nMixin( FormAssociatedRequiredMixin( EventEmitterMixin< IgcComboComponentEventMap, typeof IgcBaseComboBoxComponent >(IgcBaseComboBoxComponent) ), i18n )
The behavior of the component when a parent container scrolls.
If the value is hide, the component hides while the anchor is fully out
of view. hide is the default value.
If the value is scroll, the component stays visible and anchored.
If the value is close, the component closes on each scroll.
scrollStrategy: PopoverScrollStrategy = 'hide' Defined in src/internals/bases/combo-box.ts:65
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 = 'immediate' Defined in src/components/combo/combo.ts:549
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 = false Defined in src/components/combo/combo.ts:528
singleSelect
Section titled "singleSelect"Whether only one item can be selected. In this mode, the main input filters the list of options.
singleSelect: boolean = false Defined in src/components/combo/combo.ts:347
Optional 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 Defined in src/components/combo/combo.ts:508
Optional valueKey
Section titled "valueKey"The key in the data source used when selecting items.
valueKey: keyof T = undefined Defined in src/components/combo/combo.ts:408
tagName
Section titled "tagName"The tagName read-only property of the Element interface returns the tag name of the element on which it's called.
tagName: "igc-combo" = 'igc-combo' Defined in src/components/combo/combo.ts:180
Accessors
Section titled "Accessors"defaultValue
Section titled "defaultValue"Inherited from: I18nMixin( FormAssociatedRequiredMixin( EventEmitterMixin< IgcComboComponentEventMap, typeof IgcBaseComboBoxComponent >(IgcBaseComboBoxComponent) ), i18n )
get defaultValue(): any Defined in src/internals/mixins/forms/types.ts:158
The default value of the control. A form reset restores the value to it.
While the value is unchanged since the start or the last form reset, a new
default also sets the value. The value attribute also sets it.
set defaultValue(value: unknown): void Defined in src/internals/mixins/forms/types.ts:158
Parameters
- value:
unknown
Returns void
displayKey
Section titled "displayKey"get displayKey(): any Defined in src/components/combo/combo.ts:416
The key in the data source used to display items in the list. Falls back
to valueKey.
set displayKey(value: keyof T | undefined): void Defined in src/components/combo/combo.ts:416
Parameters
- value:
keyof T | undefined
Returns void
filteringOptions
Section titled "filteringOptions"get filteringOptions(): any Defined in src/components/combo/combo.ts:449
An object that configures the filtering of the combo.
set filteringOptions(value: Partial<FilteringOptions<T>>): void Defined in src/components/combo/combo.ts:449
Parameters
- value:
Partial<FilteringOptions<T>>
Returns void
Inherited from: I18nMixin( FormAssociatedRequiredMixin( EventEmitterMixin< IgcComboComponentEventMap, typeof IgcBaseComboBoxComponent >(IgcBaseComboBoxComponent) ), i18n )
The form that the control is associated with, or null.
get form(): HTMLFormElement | null Defined in src/internals/mixins/forms/types.ts:52
Returns HTMLFormElement | null
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>[] Defined in src/components/combo/combo.ts:633
Returns ComboValue<T>[]
placeholderSearch
Section titled "placeholderSearch"get placeholderSearch(): any Defined in src/components/combo/combo.ts:384
The placeholder text of the search input.
set placeholderSearch(value: string | undefined): void Defined in src/components/combo/combo.ts:384
Parameters
- value:
string | undefined
Returns void
required
Section titled "required"Inherited from: I18nMixin( FormAssociatedRequiredMixin( EventEmitterMixin< IgcComboComponentEventMap, typeof IgcBaseComboBoxComponent >(IgcBaseComboBoxComponent) ), i18n )
get required(): any Defined in src/internals/mixins/forms/types.ts:188
Whether the control is required. A required control that has no value, or is not checked, fails validation.
set required(value: boolean): void Defined in src/internals/mixins/forms/types.ts:188
Parameters
- value:
boolean
Returns void
selection
Section titled "selection"Returns the current selection as an array of objects as provided in the data source.
get selection(): T[] Defined in src/components/combo/combo.ts:624
Returns T[]
validationMessage
Section titled "validationMessage"Inherited from: I18nMixin( FormAssociatedRequiredMixin( EventEmitterMixin< IgcComboComponentEventMap, typeof IgcBaseComboBoxComponent >(IgcBaseComboBoxComponent) ), i18n )
The validation message of the control. It is empty when the control is valid.
get validationMessage(): string Defined in src/internals/mixins/forms/types.ts:61
Returns string
validity
Section titled "validity"Inherited from: I18nMixin( FormAssociatedRequiredMixin( EventEmitterMixin< IgcComboComponentEventMap, typeof IgcBaseComboBoxComponent >(IgcBaseComboBoxComponent) ), i18n )
The validity state of the control.
get validity(): ValidityState Defined in src/internals/mixins/forms/types.ts:55
Returns ValidityState
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.
get value(): ComboValue<T>[] Defined in src/components/combo/combo.ts:617
Returns ComboValue<T>[]
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.
set value(items: ComboValue<T>[]): void Defined in src/components/combo/combo.ts:602
Example
<igc-combo
.data=${[
{
id: 'BG01',
name: 'Sofia'
},
{
id: 'BG02',
name: 'Plovdiv'
}
]}
display-key='name'
value-key='id'
value='["BG01", "BG02"]'>
</igc-combo> Parameters
- items:
ComboValue<T>[]
Returns void
willValidate
Section titled "willValidate"Inherited from: I18nMixin( FormAssociatedRequiredMixin( EventEmitterMixin< IgcComboComponentEventMap, typeof IgcBaseComboBoxComponent >(IgcBaseComboBoxComponent) ), i18n )
Whether the control is a candidate for constraint validation.
get willValidate(): boolean Defined in src/internals/mixins/forms/types.ts:64
Returns boolean
Methods
Section titled "Methods"Removes focus from the component.
blur(): void Defined in src/components/combo/combo.ts:1285
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 Defined in src/components/combo/combo.ts:1393
Returns void
checkValidity
Section titled "checkValidity"Inherited from: I18nMixin( FormAssociatedRequiredMixin( EventEmitterMixin< IgcComboComponentEventMap, typeof IgcBaseComboBoxComponent >(IgcBaseComboBoxComponent) ), i18n )
Checks validity and emits invalid when the control is invalid. Returns
true when the control is valid.
checkValidity(): boolean Defined in src/internals/mixins/forms/types.ts:134
Returns boolean
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 Defined in src/components/combo/combo.ts:1385
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 Defined in src/components/combo/combo.ts:1343
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 Defined in src/components/combo/combo.ts:1371
Parameters
- ignoreFilter:
booleanWhether to deselect all the items.
Returns void
focus
Section titled "focus"Sets focus on the component.
focus(options: FocusOptions): void Defined in src/components/combo/combo.ts:1278
Parameters
- options:
FocusOptions
Returns void
Inherited from: I18nMixin( FormAssociatedRequiredMixin( EventEmitterMixin< IgcComboComponentEventMap, typeof IgcBaseComboBoxComponent >(IgcBaseComboBoxComponent) ), i18n )
Closes the component. It does not emit events. The promise resolves to
false when the component is already closed, or when a later call
replaces this one.
hide(): Promise<boolean> Defined in src/internals/bases/combo-box.ts:135
Returns Promise<boolean>
reportValidity
Section titled "reportValidity"Inherited from: I18nMixin( FormAssociatedRequiredMixin( EventEmitterMixin< IgcComboComponentEventMap, typeof IgcBaseComboBoxComponent >(IgcBaseComboBoxComponent) ), i18n )
Checks validity. As for a native control, an invalid control emits
invalid and takes the focus. It shows its own validation messages, not
the message of the browser. Returns true when the control is valid.
reportValidity(): boolean Defined in src/internals/mixins/forms/types.ts:141
Returns boolean
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 Defined in src/components/combo/combo.ts:1315
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 Defined in src/components/combo/combo.ts:1353
Parameters
- ignoreFilter:
booleanWhether to select all the items of
data.
Returns void
setCustomValidity
Section titled "setCustomValidity"Inherited from: I18nMixin( FormAssociatedRequiredMixin( EventEmitterMixin< IgcComboComponentEventMap, typeof IgcBaseComboBoxComponent >(IgcBaseComboBoxComponent) ), i18n )
Sets a custom validation message. The control is invalid while the message is not empty. An empty string removes the custom error.
setCustomValidity(message: string): void Defined in src/internals/mixins/forms/types.ts:147
Parameters
- message:
string
Returns void
Inherited from: I18nMixin( FormAssociatedRequiredMixin( EventEmitterMixin< IgcComboComponentEventMap, typeof IgcBaseComboBoxComponent >(IgcBaseComboBoxComponent) ), i18n )
Opens the component. It does not emit events. The promise resolves to
false when the component is already open, or when a later call replaces
this one.
show(): Promise<boolean> Defined in src/internals/bases/combo-box.ts:126
Returns Promise<boolean>
toggle
Section titled "toggle"Inherited from: I18nMixin( FormAssociatedRequiredMixin( EventEmitterMixin< IgcComboComponentEventMap, typeof IgcBaseComboBoxComponent >(IgcBaseComboBoxComponent) ), i18n )
Opens the component when it is closed, and closes it when it is open. It
does not emit events. The promise resolves to true when the state
changes.
toggle(): Promise<boolean> Defined in src/internals/bases/combo-box.ts:144