# Buttons

To use Buttons, first import `SharedModule`in your module.

```typescript
import {SharedModule} from '@gaxon/modules';

@NgModule({
  ...
  imports: [SharedModule, ...],
  ...
})
export class YourAppModule {
}
```

### Default Buttons

{% tabs %}
{% tab title="Preview" %}
![](https://4005223133-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LtxeWkvBVhyEq4IYIR1%2F-LuMwd_mKa59uRIzpOwh%2F-LuNHuYx7xeJc_LZTBSS%2Fbuttons.png?alt=media\&token=395d966e-674b-4f8a-8763-cf45b34f6d51)
{% endtab %}

{% tab title="HTML" %}

```markup
<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>
```

{% endtab %}
{% endtabs %}

### Button Tags

{% tabs %}
{% tab title="Preview" %}
![](https://4005223133-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LtxeWkvBVhyEq4IYIR1%2F-LuNHzZ4Q9C12ZosOj-X%2F-LuNOMHcMac0XJThUHmt%2Fbuttons-tags.png?alt=media\&token=a16cea60-8a89-4306-a9ef-9d3fac62770b)
{% endtab %}

{% tab title="HTML" %}

```markup
<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">
```

{% endtab %}
{% endtabs %}

### Sizes button

{% tabs %}
{% tab title="Preview" %}
![](https://4005223133-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LtxeWkvBVhyEq4IYIR1%2F-LuNOeQlExD7laMKl_zK%2F-LuNPKpoLtgt3vcQR2Ql%2Fbuttons-sizes.png?alt=media\&token=261e6608-a865-4d73-b94b-7ab6c462a45a)
{% endtab %}

{% tab title="HTML" %}

```markup
<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>
```

{% endtab %}
{% endtabs %}

### Outlines Buttons

{% tabs %}
{% tab title="First Tab" %}
![](https://4005223133-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LtxeWkvBVhyEq4IYIR1%2F-LuNOeQlExD7laMKl_zK%2F-LuNPKpn-yoSiXEhoOs7%2Fbuttons-outlines.png?alt=media\&token=44ebb8a6-21a7-4b9d-9f4a-8cc495cae8c3)
{% endtab %}

{% tab title="HTML" %}

```markup
<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>
```

{% endtab %}
{% endtabs %}

### Block Buttons

{% tabs %}
{% tab title="Preview" %}
![](https://4005223133-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LtxeWkvBVhyEq4IYIR1%2F-LuNOeQlExD7laMKl_zK%2F-LuNPKpuUKrf8FcnNZC4%2Fbuttons-blocks.png?alt=media\&token=bd43496e-52c5-4f0f-ae5b-7407c5e16bf5)
{% endtab %}

{% tab title="HTML" %}

```markup
<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>
```

{% endtab %}
{% endtabs %}

### Buttons States

{% tabs %}
{% tab title="Preview" %}
![](https://4005223133-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LtxeWkvBVhyEq4IYIR1%2F-LuNOeQlExD7laMKl_zK%2F-LuNPKptvkVo4PQ1e3vt%2Fbuttons-states.png?alt=media\&token=b0183bb5-6659-4b48-b34c-6b9a71de7e36)
{% endtab %}

{% tab title="HTML" %}

```markup
<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">Primary
    link</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>
```

{% endtab %}
{% endtabs %}

### Toggle states

{% tabs %}
{% tab title="Preview" %}
![](https://4005223133-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LtxeWkvBVhyEq4IYIR1%2F-LuNOeQlExD7laMKl_zK%2F-LuNPKpswvX2swW7_1jI%2Fbuttons-toggle-states.png?alt=media\&token=31d4722e-8389-4f7f-b646-bc1f3455836c)
{% endtab %}

{% tab title="HTML" %}

```markup
<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>
```

{% endtab %}

{% tab title="TypeScript" %}

```typescript
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;
  }
}

```

{% endtab %}
{% endtabs %}

### Checkbox buttons

{% tabs %}
{% tab title="Preview" %}
![](https://4005223133-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LtxeWkvBVhyEq4IYIR1%2F-LuNOeQlExD7laMKl_zK%2F-LuNPKpp4pviY0EDVG8i%2Fbuttons-checkboxes.png?alt=media\&token=27aa73d3-7b2b-4da5-80c4-267296d77c31)
{% endtab %}

{% tab title="HTML" %}

```markup
<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>

```

{% endtab %}

{% tab title="TypeScript" %}

```typescript
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
  };
}

```

{% endtab %}
{% endtabs %}

### Radio buttons

{% tabs %}
{% tab title="Preview" %}
![](https://4005223133-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LtxeWkvBVhyEq4IYIR1%2F-LuNOeQlExD7laMKl_zK%2F-LuNPKpqCdiCrvL34INL%2Fbuttons-radio.png?alt=media\&token=6eb09e6f-fd99-4fd6-b504-e2ed8ff8a961)
{% endtab %}

{% tab title="HTML" %}

```markup
<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>


```

{% endtab %}

{% tab title="TypeScript" %}

```typescript
import {Component} from '@angular/core';

@Component({
  selector: 'app-ngbd-buttons-radio',
  templateUrl: './buttons-radio.html'
})
export class NgbdButtonsRadio {
  option1: any = 1;
  option2: string = 'right';
}

```

{% endtab %}
{% endtabs %}
