packages/components/eui-button-group/eui-button-group.component.ts
eui-button-group component for organizing multiple buttons with optional checkbox or radio button selection behavior.
Provides visual grouping and automatic state management for single or multiple selection modes.
Supports three modes: standard (no selection), checkbox (multiple selection), and radio (single selection).
Automatically manages checked state across buttons and emits events on button interactions.
Content is projected via ng-content expecting eui-button children.
<eui-button-group>
<button euiButton id="btn1">Action 1</button>
<button euiButton id="btn2">Action 2</button>
<button euiButton id="btn3">Action 3</button>
</eui-button-group><eui-button-group [isRadioButtons]="true" (buttonClick)="onSelection($event)">
<button euiButton id="left" [isChecked]="true">Left</button>
<button euiButton id="center">Center</button>
<button euiButton id="right">Right</button>
</eui-button-group><eui-button-group [isCheckboxButtons]="true">
<button euiButton id="bold">Bold</button>
<button euiButton id="italic">Italic</button>
<button euiButton id="underline">Underline</button>
</eui-button-group>onSelection(button: EuiButtonComponent): void {
console.log('Selected button:', button.id, 'Checked:', button.isChecked);
}
| changeDetection | ChangeDetectionStrategy.OnPush |
| selector | eui-button-group |
| styleUrls | ./eui-button-group.scss |
| template | |
Properties |
Inputs |
Outputs |
HostBindings |
Accessors |
| isCheckboxButtons |
Type : boolean
|
Default value : false
|
|
Enables checkbox behavior allowing multiple buttons to be selected simultaneously. When true, buttons can be independently toggled on/off. |
| isRadioButtons |
Type : boolean
|
Default value : false
|
|
Enables radio button behavior allowing only one button to be selected at a time. When true, selecting a button automatically deselects others in the group. |
| buttonClick |
Type : EventEmitter<EuiButtonComponent>
|
|
Emitted when any button in the group is clicked. Payload: EuiButtonComponent - the clicked button instance Triggered after button state is updated based on group configuration. |
| class |
Type : string
|
|
CSS classes applied to the host element |
| buttons |
Type : QueryList<EuiButtonComponent>
|
Decorators :
@ContentChildren(undefined)
|
| cssClasses |
getcssClasses()
|
|
CSS classes applied to the host element
Returns :
string
|