Overlays

Alert dialog

@xui/alert-dialog

A modal confirmation for a consequential choice. It takes focus, blocks the page and asks for an explicit Confirm / Cancel. open is two-way bindable; confirmed / cancelled report the outcome.

Install

pnpm add @xui/alert-dialog

Add the barrel to a standalone component's imports:

import { XuiAlertDialogImports } from '@xui/alert-dialog';

@Component({
  imports: [XuiAlertDialogImports],
  // …
})

Examples

Destructive

Loading preview…

Confirm

Loading preview…

Blocking

Loading preview…

API

XuiAlertDialog

componentxui-alert-dialog

A modal confirmation dialog for a consequential choice — the kind you should stop and read. Unlike a plain dialog it takes focus, blocks the page and asks for an explicit Confirm / Cancel. open is two-way bindable; confirmed and cancelled report the outcome. Set destructive to tint the confirm button.

Variants

AxisOptionsDefaultintentcancelprimarydestructiveprimary

Inputs

NameTypeDefaultclassClassValueThe user-defined classes on the panel. Merged last so they win.''opentwo-waybooleanWhether the dialog is showing. Two-way bindable with [(open)].falsetitlestringThe question being asked. Rendered as the dialog's heading and used as its accessible name.''descriptionstringWhat confirming will do. Spell out anything irreversible here rather than in the title.''confirmTextstringLabel of the confirm button. Name the action ("Delete project") rather than saying "OK".'Confirm'cancelTextstringLabel of the cancel button, which holds the initial focus.'Cancel'destructivebooleanRender the confirm button in the error colour, for an action that destroys something.falsedismissiblebooleanAllow Escape and a backdrop click to dismiss (as a cancel).true

Outputs

NameTypeconfirmedvoidEmits when the confirm button is pressed. The dialog closes either way — this is where the action goes.cancelledvoidEmits when the dialog is dismissed without confirming.

Source

libs/ui/alert-dialog/xui

xUI 2.0.0 — Apache 2.0 licensed. Built with Angular and Tailwind CSS.