# Alert

O componente de alerta utiliza o [Dialog ](/janelas-e-alertas/dialog.md)por debaixo dos panos e serve como uma abstração de janela para feedbacks do sistema podendo optar por **sucesso**, **alerta**, **error** e **informação**.

### Uso

{% code title="page-alert.component.html" %}

```html
<cat-toolbar [config]="getToolbarInfo()">
  <nav buttons>
    <cat-success-button class="mr-8" (click)="openAlert('success')">Sucesso</cat-success-button>
    <cat-warning-button class="mr-8" (click)="openAlert('warning')">Atenção</cat-warning-button>
    <cat-danger-button class="mr-8" (click)="openAlert('error')">Error</cat-danger-button>
    <cat-info-button (click)="openAlert('info')">Informação</cat-info-button>
  </nav>
</cat-toolbar>
```

{% endcode %}

{% code title="page-alert.component.ts" lineNumbers="true" %}

```typescript
import { Component } from '@angular/core';
import { CatAlertService, CatAlertType } from '@catrx/ui/alert';
import { CatComponentBase } from '@catrx/ui/common';

@Component({
  templateUrl: './page-alert.component.html',
})
export class PageAlertComponent extends CatComponentBase {
  constructor(private alertService: CatAlertService) {
    super();
  }

  openAlert(type: CatAlertType) {
    this.alertService.show({
      type,
      message: `Alerta de Tipo: <b>${type}</b>`,
    });
  }
}
```

{% endcode %}

{% code title="page-alert.module.ts" lineNumbers="true" %}

```typescript
import { NgModule } from '@angular/core';
import { CatAlertModule } from '@catrx/ui/alert';
import { CatSuccessButtonComponent } from '@catrx/ui/button/seccess';
import { CatWarningButtonComponent } from '@catrx/ui/button/warning';
import { CatDangerButtonComponent } from '@catrx/ui/button/danger';
import { CatInfoButtonComponent } from '@catrx/ui/button/info';
import { CatToolbarModule } from '@catrx/ui/toolbar';
import { PageAlertComponent } from './page-alert.component';
import { PageAlertRoutingModule } from './page-alert.routing.module';

@NgModule({
  declarations: [PageAlertComponent],
  imports: [
    CatToolbarModule,
    CatSuccessButtonComponent,
    CatWarningButtonComponent,
    CatDangerButtonComponent,
    CatInfoButtonComponent,
    CatAlertModule,
    PageAlertRoutingModule,
  ],
})
export class PageAlertModule {}
```

{% endcode %}

### Overview

{% embed url="<https://cat-ui.igordrangel.com.br/components/alert>" %}


---

# 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://doc.catui.igordrangel.com.br/janelas-e-alertas/alert.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.
