The Dialog API provides standardized dialogs that work consistently across desktop and web environments. Extension authors will find the prompt and confirm methods most useful.
// Show a prompt dialogapp.extensionManager.dialog.prompt({ title: "User Input", message: "Please enter your name:", defaultValue: "User"}).then(result => { if (result !== null) { console.log(`Input: ${result}`); }});
app.extensionManager.dialog.prompt({ title: string, // Dialog title message: string, // Message/question to display defaultValue?: string // Initial value in the input field (optional)}).then((result: string | null) => { // result is the entered text, or null if cancelled});
app.extensionManager.dialog.confirm({ title: string, // Dialog title message: string, // Message to display type?: "default" | "overwrite" | "delete" | "dirtyClose" | "reinstall", // Dialog type (optional) itemList?: string[], // List of items to display (optional) hint?: string // Hint text to display (optional)}).then((result: boolean | null) => { // result is true if confirmed, false if denied, null if cancelled});
For other specialized dialogs available in ComfyUI, extension authors can refer to the dialogService.ts file in the source code.