Dialog Window

The Dialog() class provides an extension of Application() which makes it easy to create modal dialog prompts.

class Dialog(dialogData, options)

Create a modal dialog window displaying a title, a message, and a set of buttons which trigger callback functions.

  • dialogData (Object) – An object of dialog data which configures how the modal window is rendered
  • dialogData.title (String) – The window title
  • dialogData.content (String) – HTML content
  • dialogData.close (function) – Common callback operations to perform when the dialog is closed
  • dialogData.buttons (Object) – Action buttons which trigger callback functions. Buttons are defined as an Object with the format {name: buttonData}. Valid keys for buttonData include:
  • dialogData.buttons.button.icon (String) – A button icon
  • dialogData.buttons.button.label (String) – A button label
  • dialogData.buttons.button.callback (function) – A callback function taking no arguments
  • options (Object) – Dialog rendering options, see Application()
  • options.default – The name of the default button which should be triggered on Enter


let d = new Dialog({
 title: "Test Dialog",
 content: "<p>You must choose either Option 1, or Option 2</p>",
 buttons: {
  one: {
   icon: '<i class="fas fa-check"></i>',
   label: "Option One",
   callback: () => console.log("Chose One")
  two: {
   icon: '<i class="fas fa-times"></i>',
   label: "Option Two",
   callback: () => console.log("Chose Two")
 default: "two",
 close: () => console.log("This always is logged no matter which option is chosen")
Dialog.Application.render(force=false, position)

Render the Application by evaluating it’s HTML template against the object of data provided by the getData method If the Application is rendered as a pop-out window, wrap the contained HTML in an outer frame with window controls

  • force (Boolean) – Add the rendered application to the DOM if it is not already present. If false, the Application will only be re-rendered if it is already present.
  • position (Object) – Positioning options which are applied when rendering the new Application

Assign the default options which are supported by this Application