# Confirm

O componente de confirmação utiliza o [Dialog ](/janelas-e-alertas/dialog.md)por debaixo dos panos e serve como uma abstração de uma janela de pergunta de **Sim** ou **Não**.

{% hint style="info" %}
O componente de confirmação **possui um ícone padrão**, porém, **caso queira alterar para algum de sua escolha**, poderá trocá-lo informando nas **opções** pelo atributo **icon** um [CatDynamicComponent ](/exibicao-de-dados/componentes-dinamicos.md)passando seu componente de ícone do método ask assim como alguma ação, caso o usuário clique em não.
{% endhint %}

### Uso

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

```typescript
import { Component } from '@angular/core';
import { CatConfirmService } from '@catrx/ui/confirm';
import { CatComponentBase } from '@catrx/ui/common';

@Component({
  templateUrl: './page-confirm.component.html'
})
export class PageConfirmComponent extends CatComponentBase {
  constructor(private confirmService: CatConfirmService) {
    super();
  }

  public ask() {
    this.confirmService.ask(
      'Você deseja mesmo continuar?',
      () => alert('Clicou em Sim'),
      {noCb: () => alert('Clicou em Não')}
    );
  }
}
```

{% endcode %}

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

```typescript
import { NgModule } from '@angular/core';
import { CatConfirmModule } from '@catrx/ui/confirm';
import { CatToolbarModule } from '@catrx/ui/toolbar';
import { PageConfirmComponent } from './page-confirm.component';
import { PageConfirmRoutingModule } from './page-confirm.routing.module';

@NgModule({
  declarations: [PageConfirmComponent],
  imports: [CatToolbarModule, CatConfirmModule, PageConfirmRoutingModule],
})
export class PageConfirmModule {}
```

{% endcode %}

{% code title="page-confirm.component.ts" %}

```html
<cat-toolbar [config]="getToolbarInfo()">
  <nav buttons>
    <button (click)="ask()" type="button" class="btn btn-primary btn-sm">
      Confirmar
    </button>
  </nav>
</cat-toolbar>
```

{% endcode %}

### Overview

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


---

# 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/confirm.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.
