Comprehensive guide for implementing Syncfusion TypeScript Dialog (popup) components. Use this when building modal or modeless dialogs, alert/confirm windows, or DialogUtility-based prompts in TypeScript/EJ2 projects. Covers animations, drag, resize, nested dialogs, templates, and WAI-ARIA accessibility.
A comprehensive skill for implementing the Syncfusion Dialog component in TypeScript. The Dialog displays content in an overlay window above the main page, supporting modal/modeless modes, custom templates, action buttons, animations, drag, resize, and built-in utility dialogs (alert/confirm).
📄 Read: references/dialog-getting-started.md
position propertyshow(), hide())📄 Read: references/dialog-templates.md
📄 Read: references/dialog-features.md
animationSettings: effect, duration, delay)enableResize, resizeHandles)locale property and L10n.load)zIndex)enablePersistence)enableRtl)cssClass)show(true)beforeOpen eventcssClass: 'e-fixed'minHeight on Dialog's parent element to ensure minimum visible space📄 Read: references/dialog-events.md
beforeOpen — prevent opening, set maxHeightbeforeClose — prevent closing, prevent focus returnopen — post-open actions, prevent focus on first elementclose — post-close actionsoverlayClick — close dialog on overlay clickdrag, dragStart, dragStopresizeStart, resizing, resizeStopcreated, destroyed events📄 Read: references/dialog-how-to.md
DialogUtility.alert() — simple and with optionsDialogUtility.confirm() — simple and with options📄 Read: references/dialog-api.md
AnimationSettingsModel sub-propertiesButtonPropsModel sub-propertiesimport { Dialog } from '@syncfusion/ej2-popups';
import { enableRipple } from '@syncfusion/ej2-base';
enableRipple(true);
// HTML: <div id="dialog"></div>
// HTML: <button id="openBtn">Open Dialog</button>
let dialog: Dialog = new Dialog({
header: 'Welcome',
content: 'This is a simple dialog.',
showCloseIcon: true,
width: '350px',
target: document.body,
buttons: [
{
buttonModel: { content: 'OK', isPrimary: true },
click: () => { dialog.hide(); }
}
]
});
dialog.appendTo('#dialog');
document.getElementById('openBtn').onclick = () => { dialog.show(); };
import { Dialog } from '@syncfusion/ej2-popups';
let dialog: Dialog = new Dialog({
header: 'Confirm Action',
content: 'Are you sure you want to proceed?',
isModal: true,
showCloseIcon: true,
width: '400px',
target: document.body,
overlayClick: () => { dialog.hide(); },
buttons: [
{ buttonModel: { content: 'Yes', isPrimary: true }, click: () => { /* action */ dialog.hide(); } },
{ buttonModel: { content: 'No', cssClass: 'e-flat' }, click: () => { dialog.hide(); } }
]
});
dialog.appendTo('#dialog');
import { DialogUtility } from '@syncfusion/ej2-popups';
// Simple alert
DialogUtility.alert('Operation completed successfully!');
// Confirm with custom actions
DialogUtility.confirm({
title: 'Delete Item',
content: 'This action cannot be undone. Continue?',
okButton: { text: 'Delete', click: () => { /* delete logic */ } },
cancelButton: { text: 'Cancel' },
showCloseIcon: true,
closeOnEscape: true
});
import { Dialog } from '@syncfusion/ej2-popups';
// Set minHeight on the parent/target element so the Dialog always
// has enough vertical space to render correctly inside its container.
const container = document.getElementById('container') as HTMLElement;
container.style.minHeight = '400px';
let dialog: Dialog = new Dialog({
header: 'Notice',
content: 'Dialog rendered inside a container with minHeight.',
showCloseIcon: true,
width: '350px',
target: container, // Dialog is scoped to this container
buttons: [
{
buttonModel: { content: 'OK', isPrimary: true },
click: () => { dialog.hide(); }
}
]
});
dialog.appendTo('#dialog');
(document.getElementById('targetButton') as HTMLElement).onclick = () => {
dialog.show();
};
import { Dialog } from '@syncfusion/ej2-popups';
let dialog: Dialog = new Dialog({
header: 'Login',
content: document.getElementById('loginForm'),
isModal: true,
width: '350px',
target: document.body,
beforeClose: (args) => {
const username = (document.getElementById('username') as HTMLInputElement).value;
if (!username) {
args.cancel = true; // prevent close
alert('Please enter a username');
}
},
buttons: [
{ buttonModel: { content: 'Login', isPrimary: true }, click: () => { dialog.hide(); } }
]
});
dialog.appendTo('#dialog');
| Property | Type | Default | Purpose |
|---|---|---|---|
header | string | HTMLElement | '' | Dialog title text or HTML |
content | string | HTMLElement | '' | Dialog body content |
isModal | boolean | false | Show as modal with overlay |
showCloseIcon | boolean | false | Show × button in header |
visible | boolean | true | Initial visibility |
width | string | number | '100%' | Dialog width |
height | string | number | 'auto' | Dialog height |
position | PositionDataModel | {X:'center',Y:'center'} | Position in target |
target | HTMLElement | string | null (body) | Container element |
buttons | ButtonPropsModel[] | [{}] | Footer action buttons |
footerTemplate | string | HTMLElement | '' | Custom footer HTML |
allowDragging | boolean | false | Enable header drag |
enableResize | boolean | false | Enable resize handles |
resizeHandles | ResizeDirections[] | ['South-East'] | Resize directions |
animationSettings | AnimationSettingsModel | {effect:'Fade',duration:400,delay:0} | Open/close animation |
cssClass | string | '' | Custom CSS classes |
closeOnEscape | boolean | true | Close on Esc key |
zIndex | number | 1000 | Stack order |
locale | string | '' | Culture for localization |
enableRtl | boolean | false | Right-to-left mode |
isModal: true with OK/Cancel buttons and beforeClose validationcontent, read values in button click handlerDialogUtility.alert() for minimal codedialog.show(true)target pointing to outer dialog element for nested dialogsallowDragging: true requires header to be setminHeight: '400px' on the Dialog's parent element when using a scoped target to guarantee the Dialog has sufficient vertical space to render without clipping