packages/components/eui-autocomplete/eui-autocomplete-option-group/eui-autocomplete-option-group.component.ts
Option group component for organizing eui-autocomplete options into labeled sections.
Used internally by eui-autocomplete when groupBy property is configured on the parent.
Provides semantic grouping with ARIA optgroup role for accessibility.
Automatically renders group headers based on the groupBy property path.
Content is projected via ng-content to contain individual eui-autocomplete-option components.
Not intended for direct use in templates - managed internally by eui-autocomplete.
This component is used internally when groupBy is configured on eui-autocomplete:
Example :<eui-autocomplete
[autocompleteData]="countries"
[groupBy]="'metadata.continent'">
</eui-autocomplete>countries: EuiAutoCompleteItem[] = [
{ id: 1, label: 'China', metadata: { continent: 'Asia' } },
{ id: 2, label: 'Japan', metadata: { continent: 'Asia' } },
{ id: 3, label: 'France', metadata: { continent: 'Europe' } },
{ id: 4, label: 'Germany', metadata: { continent: 'Europe' } }
];
// Results in two groups: "Asia" and "Europe"| changeDetection | ChangeDetectionStrategy.OnPush |
| encapsulation | ViewEncapsulation.None |
| selector | eui-autocomplete-option-group |
| template | |
Properties |
Inputs |
HostBindings |
Accessors |
| label |
Type : string
|
|
Text label displayed as the group header. Identifies the category or section name for the grouped options. Required for proper group identification. |
| attr.role |
Type : string
|
Default value : 'optgroup'
|
|
ARIA role for the host element to ensure proper accessibility. |
| class |
Type : string
|
|
Computes and returns the CSS classes for the component based on its current state. |
| role |
Type : string
|
Default value : 'optgroup'
|
Decorators :
@HostBinding('attr.role')
|
|
ARIA role for the host element to ensure proper accessibility. |
| cssClasses |
getcssClasses()
|
|
Computes and returns the CSS classes for the component based on its current state.
Returns :
string
|