To use Buttons, first import SharedModule
in your module.
import {SharedModule} from '@gaxon/modules';​@NgModule({...imports: [SharedModule, ...],...})export class YourAppModule {}
<button type="button" class="btn btn-primary mr-2 mb-2">Primary</button><button type="button" class="btn btn-secondary mr-2 mb-2">Secondary</button><button type="button" class="btn btn-success mr-2 mb-2">Success</button><button type="button" class="btn btn-danger mr-2 mb-2">Danger</button><button type="button" class="btn btn-warning mr-2 mb-2">Warning</button><button type="button" class="btn btn-info mr-2 mb-2">Info</button><button type="button" class="btn btn-light mr-2 mb-2">Light</button><button type="button" class="btn btn-dark mr-2 mb-2">Dark</button><button type="button" class="btn btn-link mb-2">Link</button>
<a class="btn btn-primary mr-2 mb-2" href="javascript:void(0)" role="button">Link</a><button class="btn btn-primary mr-2 mb-2" type="submit">Button</button><input class="btn btn-primary mr-2 mb-2" type="button" value="Input"><input class="btn btn-primary mr-2 mb-2" type="submit" value="Submit"><input class="btn btn-primary mb-2" type="reset" value="Reset">
<button type="button" class="btn btn-primary btn-lg mr-2">Large button</button><button type="button" class="btn btn-primary mr-2">Default button</button><button type="button" class="btn btn-secondary btn-sm">Small button</button>
<button type="button" class="btn btn-outline-primary mr-2 mb-2">Primary</button><button type="button" class="btn btn-outline-secondary mr-2 mb-2">Secondary</button><button type="button" class="btn btn-outline-success mb-2">Success</button>
<button type="button" class="btn btn-primary btn-block">Block level button</button><button type="button" class="btn btn-secondary btn-block">Block level button</button>
<h5 class="text-muted">Active State Buttons</h5><div class="mb-5"><button type="button" class="btn btn-primary active mr-2 mb-2">Primary button</button><button type="button" class="btn btn-secondary active mr-2 mb-2">Button</button><a href="javascript:void(0)" class="btn btn-primary active mr-2 mb-2" role="button" aria-pressed="true">Primarylink</a><a href="javascript:void(0)" class="btn btn-secondary active mb-2" role="button"aria-pressed="true">Link</a></div>​<h5 class="text-muted">Disabled State Buttons</h5><div class="mb-0"><button type="button" class="btn btn-primary mr-2 mb-2" disabled>Primary button</button><button type="button" class="btn btn-secondary mr-2 mb-2" disabled>Button</button><a href="javascript:void(0)" class="btn btn-primary mr-2 mb-2 disabled" tabindex="-1" role="button"aria-disabled="true">Primary link</a><a href="javascript:void(0)" class="btn btn-secondary mb-2 disabled" tabindex="-1" role="button"aria-disabled="true">Link</a></div>
<button type="button" class="btn btn-primary mr-2 mb-2" [ngClass]="{active:toggle_btn_primary}"(click)="togglePrimaryButton()" aria-pressed="false"autocomplete="off">Single toggle</button>​<button type="button" class="btn btn-outline-secondary mb-2" [ngClass]="{active:toggle_btn_secondary}"(click)="toggleSecondaryButton()" aria-pressed="false"autocomplete="off">Single toggle</button>
import {Component} from '@angular/core';​@Component({selector: 'ngbd-buttons',templateUrl: './buttons.component.html'})export class NgbdButtons {toggle_btn_primary: boolean = true;toggle_btn_secondary: boolean = false;​togglePrimaryButton() {this.toggle_btn_primary = !this.toggle_btn_primary;}​toggleSecondaryButton() {this.toggle_btn_secondary = !this.toggle_btn_secondary;}}​
<h5 class="text-muted">Checkbox Buttons Example</h5>​<div class="example-row mb-2"><span class="btn-group-toggle mr-2"><label class="btn btn-secondary active" ngbButtonLabel><input type="checkbox" ngbButton [(ngModel)]="model.button1"> {{(model.button1)? 'Checked' : 'Unchecked'}}</label></span>​<span class="btn-group-toggle"><label class="btn btn-outline-primary" ngbButtonLabel><input type="checkbox" ngbButton [(ngModel)]="model.button2"> {{(model.button2)? 'Checked' : 'Unchecked'}}</label></span></div>​<h5 class="text-muted">Checkbox Button Group Example</h5>​<div class="example-row mb-2"><div class="btn-group btn-group-toggle"><label class="btn-primary" ngbButtonLabel><input type="checkbox" ngbButton [(ngModel)]="model.left"> {{(model.left) ? 'Checked' : 'Left'}}</label><label class="btn-primary" ngbButtonLabel><input type="checkbox" ngbButton [(ngModel)]="model.middle"> {{(model.middle) ? 'Checked' : 'Middle'}}</label><label class="btn-primary" ngbButtonLabel><input type="checkbox" ngbButton [(ngModel)]="model.right"> {{(model.right) ? 'Checked' : 'Right'}}</label></div></div>​
import {Component} from '@angular/core';​@Component({selector: 'app-ngbd-buttons-checkbox',templateUrl: './buttons-checkbox.html'})export class NgbdButtonsCheckbox {model = {button1: true,button2: false,left: true,middle: false,right: false};}​
<div class="btn-group btn-group-toggle mr-2 mb-2" ngbRadioGroup name="radioBasic" [(ngModel)]="option1"><label ngbButtonLabel class="btn-primary"><input ngbButton type="radio" [value]="1"> {{(option1 == 1)? 'Active' : 'Left'}}</label><label ngbButtonLabel class="btn-primary"><input ngbButton type="radio" value="middle"> {{(option1 == 'middle')? 'Active' : 'Middle'}}</label><label ngbButtonLabel class="btn-primary"><input ngbButton type="radio" [value]="false"> {{(!option1)? 'Active' : 'Right'}}</label></div>​<div class="btn-group btn-group-toggle mb-2" ngbRadioGroup name="radio_option2" [(ngModel)]="option2"><label class="btn btn-outline-secondary" ngbButtonLabel><input type="radio" ngbButton value="left"> {{(option2 == 'left')? 'Active' : 'Radio'}}</label><label class="btn btn-outline-secondary" ngbButtonLabel><input type="radio" ngbButton value="middle"> {{(option2 == 'middle')? 'Active' : 'Radio'}}</label><label class="btn btn-outline-secondary" ngbButtonLabel><input type="radio" ngbButton value="right"> {{(option2 == 'right')? 'Active' : 'Radio'}}</label></div>​​
import {Component} from '@angular/core';​@Component({selector: 'app-ngbd-buttons-radio',templateUrl: './buttons-radio.html'})export class NgbdButtonsRadio {option1: any = 1;option2: string = 'right';}​