The ButtonGroup component for Angular represents a set of buttons that can work as normal buttons, radio buttons or checkboxes.
npm install -g @angular/cli ng new jqwidgets-project cd jqwidgets-project
ng add jqwidgets-ng
jQWidgets UI for Angular is distributed as jqwidgets-ng NPM package
npm install jqwidgets-ng
@import 'jqwidgets-ng/jqwidgets/styles/jqx.base.css';
"styles": [ "node_modules/jqwidgets-ng/jqwidgets/styles/jqx.base.css" ]
<jqxButtonGroup [theme]="'fluent'" #myButtonGroup (onButtonclick)="groupOnBtnClick($event)">
<button style="padding: 4px 16px" id='Left' value='Left'></button>
<button style="padding: 4px 16px" id='Center' value='Center'></button>
<button style="padding: 4px 16px" id='Right' value='Right'></button>
</jqxButtonGroup>
<div style="margin-top: 10px">
<h4>Modes</h4>
<jqxRadioButton [theme]="'fluent'" (onChecked)="myDefaultModeButtonChecked()" [checked]="true">Default</jqxRadioButton>
<jqxRadioButton [theme]="'fluent'" (onChecked)="myRadioModeButtonChecked()">RadioButtons</jqxRadioButton>
<jqxRadioButton [theme]="'fluent'" (onChecked)="myCheckBoxModeButtonChecked()">CheckBoxes</jqxRadioButton>
</div>
<div #myLog style="margin-top: 10px;"></div>
import { Component, ViewChild, ElementRef } from '@angular/core';
import { jqxButtonGroupModule, jqxButtonGroupComponent } from 'jqwidgets-ng/jqxbuttongroup';
import { jqxRadioButtonComponent, jqxRadioButtonModule } from 'jqwidgets-ng/jqxradiobutton';
@Component({
selector: 'app-root',
imports: [jqxButtonGroupModule, jqxRadioButtonModule],
standalone: true,
templateUrl: './app.component.html'
})
export class AppComponent {
@ViewChild('myButtonGroup') myButtonGroup: jqxButtonGroupComponent;
@ViewChild('myLog') myLog: ElementRef;
myDefaultModeButtonChecked(): void {
this.myButtonGroup.mode('default');
};
myRadioModeButtonChecked(): void {
this.myButtonGroup.mode('radio');
};
myCheckBoxModeButtonChecked(): void {
this.myButtonGroup.mode('checkbox');
};
groupOnBtnClick(event: any): void {
let clickedButton = event.args.button;
this.myLog.nativeElement.innerHTML = `Clicked: ${clickedButton[0].id}`;
}
}