File: confirmpopup.md | Updated: 11/15/2025
Primary
Surface
PresetsAuraMaterialLaraNora
Ripple
RTL
v20
FEATURES
API
THEMING
PASSTHROUGH
ConfirmPopup displays a confirmation overlay displayed relatively to its target.
import { ConfirmPopupModule } from 'primeng/confirmpopup';
ConfirmPopup is defined using p-confirmPopup tag and an instance of ConfirmationService is required to display it bycalling confirm method.
SaveDelete
<p-toast /> <p-confirmpopup /> <p-button (onClick)="confirm1($event)" label="Save" [outlined]="true" /> <p-button (onClick)="confirm2($event)" label="Delete" severity="danger" [outlined]="true" />Content section can be customized using content template.
Save
<p-toast /> <p-confirmpopup> <ng-template #content let-message> <div class="flex flex-col items-center w-full gap-4 border-b border-surface-200 dark:border-surface-700 p-4 mb-4 pb-0" > <i [class]="message.icon" class="!text-6xl text-primary-500"></i> <p>{{ message.message }}</p> </div> </ng-template> </p-confirmpopup> <p-button (click)="confirm($event)" label="Save" />Headless mode allows you to customize the entire user interface instead of the default elements.
Save
<p-toast /> <p-confirmpopup #cp> <ng-template #headless let-message> <div class="rounded p-4"> <span>{{ message.message }}</span> <div class="flex items-center gap-2 mt-4"> <p-button (onClick)="cp.onAccept()" label="Save" size="small" /> <p-button (onClick)="cp.onReject()" label="Cancel" [text]="true" size="small" severity="secondary" /> </div> </div> </ng-template> </p-confirmpopup> <p-button (onClick)="confirm($event)" label="Save" />ConfirmPopup component uses alertdialog role and since any attribute is passed to the root element you may define attributes like aria-label or aria-labelledby to describe the popup contents. In addition aria-modal is added since focus is kept within the popup.
It is recommended to use a trigger component that can be accessed with keyboard such as a button, if not adding tabIndex would be necessary. ConfirmPopup adds aria-expanded state attribute and aria-controls to the trigger so that the relation between the trigger and the popup is defined.
When the popup gets opened, the first focusable element receives the focus and this can be customized by adding autofocus to an element within the popup.
| Key | Function | | --- | --- | | tab | Moves focus to the next the focusable element within the popup. | | shift + tab | Moves focus to the previous the focusable element within the popup. | | escape | Closes the popup and moves focus to the trigger. |
| Key | Function | | --- | --- | | enter | Triggers the action, closes the popup and moves focus to the trigger. | | space | Triggers the action, closes the popup and moves focus to the trigger. |
Import
Basic
Template
Headless
Accessibility


Theme Designer
Theme Designer is the ultimate tool to customize and design your own themes featuring a visual editor, figma to theme code, cloud storage, and migration assistant.
PrimeNG 20.3.0 by PrimeTek