# 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" %}
![](/files/-LuNHuYx7xeJc_LZTBSS)
{% 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" %}
![](/files/-LuNOMHcMac0XJThUHmt)
{% 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" %}
![](/files/-LuNPKpoLtgt3vcQR2Ql)
{% 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" %}
![](/files/-LuNPKpn-yoSiXEhoOs7)
{% 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" %}
![](/files/-LuNPKpuUKrf8FcnNZC4)
{% 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" %}
![](/files/-LuNPKptvkVo4PQ1e3vt)
{% 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" %}
![](/files/-LuNPKpswvX2swW7_1jI)
{% 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" %}
![](/files/-LuNPKpp4pviY0EDVG8i)
{% 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" %}
![](/files/-LuNPKpqCdiCrvL34INL)
{% 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 %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs-drift-angular.g-axon.work/components/buttons.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
