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, options)

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.
  • options (Object) – Additional rendering options which are applied to customize the way that the Application is rendered in the DOM.
  • options.left (Number) – The left positioning attribute
  • options.top (Number) – The top positioning attribute
  • options.width (Number) – The rendered width
  • options.height (Number) – The rendered height
  • options.scale (Number) – The rendered transformation scale
  • options.log (Boolean) – Whether to display a log message that the Application was rendered
  • options.renderContext (String) – A context-providing string which suggests what event triggered the render
  • options.renderData (*) – The data change which motivated the render request

Assign the default options which are supported by this Application