Skip to content

Dialog

<ax-dialog> is a modal dialog rendered in a CDK overlay. Bind [(open)] to control it. Content projects into attribute slots: [axDialogTitle], [axDialogDescription], [axDialogBody], and [axDialogFooter]. Use AxDialogService when you need to open an arbitrary component programmatically.

import {
AxDialogComponent,
AxDialogTitleDirective,
AxDialogDescriptionDirective,
AxDialogService,
DialogRef,
DIALOG_DATA,
AxOverlayCloseDirective,
} from '@axisui-ng/overlays';
<ax-button (clickEvent)="open.set(true)">Edit profile</ax-button>
<ax-dialog [(open)]="open">
<h2 axDialogTitle>Edit profile</h2>
<p axDialogDescription>Update your account details.</p>
<div axDialogBody></div>
<div axDialogFooter>
<ax-button variant="ghost" axOverlayClose>Cancel</ax-button>
<ax-button variant="primary" (clickEvent)="save()">Save</ax-button>
</div>
</ax-dialog>
InputTypeDefaultNotes
openmodel<boolean>falseTwo-way open state.
closeOnEscapebooleantrueClose when Escape is pressed.
closeOnBackdropbooleantrueClose when the backdrop is clicked.
MarkerKindNotes
axDialogTitleDirective (AxDialogTitleDirective)Assigns a stable id; wires aria-labelledby when projected.
axDialogDescriptionDirective (AxDialogDescriptionDirective)Assigns a stable id; wires aria-describedby when projected.
axDialogBodyAttribute slotMain content region (select="[axDialogBody]").
axDialogFooterAttribute slotAction row; empty footer is hidden.
axOverlayCloseDirective (AxOverlayCloseDirective)On a button inside the dialog; calls close() via OVERLAY_REF.

Unmarked projected content also lands in the body region.

const ref = dialog.open(ConfirmComponent, {
data: { message: 'Sure?' },
size: 'md',
closeOnEscape: true,
closeOnBackdrop: true,
closeButton: true,
});
ref.result$.subscribe((result) => { /* … */ });
OptionTypeDefaultNotes
backdropbooleantrueRender a modal backdrop.
closeOnEscapebooleantrueClose when Escape is pressed.
closeOnBackdropbooleantrueClose on backdrop click (only when backdrop is true).
closeButtonbooleantrueRender a dismiss (“X”) button in the container.
size'sm' | 'md' | 'lg''md'Panel max-width.
ariaLabelstring | nullnullAccessible name when content has no labelled title.
customClassstringExtra class(es) on the overlay pane.
dataunknownInjected into the opened component via DIALOG_DATA.

The opened component can inject DialogRef (or OVERLAY_REF) and call close(result?). result$ emits once then completes.

role="dialog" aria-modal="true", labelled by [axDialogTitle] and described by [axDialogDescription] when those markers are present. Focus is trapped while open (cdkTrapFocus with auto-capture). Escape and backdrop close when enabled. Prefer axOverlayClose or open.set(false) / DialogRef.close() for explicit dismiss.

Interactive examples live in Storybook under Overlays / Dialog (including programmatic AxDialogService). Run pnpm storybook to explore them.