Class IgxButtonGroupComponent

Ignite UI for Angular Button Group - Documentation

The Ignite UI Button Group displays a group of buttons either vertically or horizontally. The group supports single, multi and singleRequired selection.

Example:

<igx-buttongroup selectionMode="multi" [values]="fontOptions">
</igx-buttongroup>

The fontOptions value shown above is defined as:

this.fontOptions = [
{ icon: 'format_bold', selected: false },
{ icon: 'format_italic', selected: false },
{ icon: 'format_underlined', selected: false }];

Hierarchy

Hierarchy

  • DisplayDensityBase
    • IgxButtonGroupComponent

Implements

  • AfterContentInit
  • AfterViewInit
  • OnDestroy

Constructors

Properties

densityChanged: EventEmitter<IDensityChangedEventArgs> = ...
deselected: EventEmitter<IButtonGroupEventArgs> = ...

An

Ouput

property that emits an event when a button is deselected.

 @ViewChild("toast")
private toast: IgxToastComponent;
public deselectedHandler(buttongroup){
this.toast.open()
}
//...
<igx-buttongroup> #MyChild [selectionMode]="'multi'" (deselected)="deselectedHandler($event)"></igx-buttongroup>
<igx-toast #toast>You have deselected a button!</igx-toast>
id: string = ...

Gets/Sets the value of the id attribute. If not set it will be automatically generated.

 <igx-buttongroup [id]="'igx-dialog-56'" [selectionMode]="'multi'" [values]="alignOptions">
selected: EventEmitter<IButtonGroupEventArgs> = ...

An

Ouput

property that emits an event when a button is selected.

@ViewChild("toast")
private toast: IgxToastComponent;
public selectedHandler(buttongroup) {
this.toast.open()
}
//...
<igx-buttongroup #MyChild [selectionMode]="'multi'" (selected)="selectedHandler($event)"></igx-buttongroup>
<igx-toast #toast>You have made a selection!</igx-toast>
values: any

Property that configures the buttons in the button group using a collection of Button objects.

 public ngOnInit() {
this.cities = [
new Button({
label: "Sofia"
}),
new Button({
label: "London"
}),
new Button({
label: "New York",
selected: true
}),
new Button({
label: "Tokyo"
})
];
}
//..
 <igx-buttongroup [selectionMode]="'single'" [values]="cities"></igx-buttongroup>

Accessors

  • get isVertical(): boolean
  • Returns true if the igx-buttongroup alignment is vertical. Note that in order for the accessor to work correctly the property should be set explicitly.

    <igx-buttongroup #MyChild [alignment]="alignment" [values]="alignOptions">
    
    //...
    @ViewChild("MyChild")
    private buttonG: IgxButtonGroupComponent;
    ngAfterViewInit(){
    let orientation = this.buttonG.isVertical;
    }

    Returns boolean

  • get itemContentCssClass(): string
  • Returns the CSS class of the item content of the IgxButtonGroup.

     @ViewChild("MyChild")
    public buttonG: IgxButtonGroupComponent;
    ngAfterViewInit(){
    let buttonSelect = this.buttonG.itemContentCssClass;
    }

    Returns string

  • set itemContentCssClass(value): void
  • Allows you to set a style using the itemContentCssClass input. The value should be the CSS class name that will be applied to the button group.

    public style1 = "styleClass";
    //..
    <igx-buttongroup [itemContentCssClass]="style1" [selectionMode]="'multi'" [values]="alignOptions">
    

    Parameters

    • value: string

    Returns void

Methods

  • Sets the --component-size CSS variable based on the value of Display Density

    Returns "var(--ig-size, var(--ig-size-small))" | "var(--ig-size, var(--ig-size-medium))" | "var(--ig-size, var(--ig-size-large))"