The Application Class

The Application() class provides the foundation for UI elements in Foundry VTT. As a developer, you should extend this class to define your own custom UI concepts which can be rendered in-game.

class Application(options)

The standard application window that is rendered for a large variety of UI elements in Foundry VTT

  • options (Object) – Configuration options which control how the application is rendered
  • options.height (Number) – The height in pixels (or “auto”) for the rendered element
  • options.width (Number) – The width in pixels (or “auto”) for the rendered element
  • (Number) – The vertical position (from the top) of the rendered element
  • options.left (Number) – The horizontal position (from the left) of the rendered element
  • options.popOut (Boolean) – Display the element wrapped in a containing window frame (true, the default) or only the inner HTML (false).

Once the HTML for an Application has been rendered, activate event listeners which provide interactivity for the application

  • html (jQuery|HTMLElement) –

type: Number

The application ID is a unique incrementing integer which is used to identify every application window drawn by the VTT


Close the application and un-register references to it within UI mappings


Assign the default options which are supported by this Application


type: jQuery|HTMLElement

Return the active application element, if it currently exists in the DOM


type: Object

The options provided to this application upon initialization


type: boolean

Control the rendering style of the application. If popOut is true, the application is rendered in its own wrapper window, otherwise only the inner app content is rendered


A convenient reference to the positioning attributes provided as Application options


Wrap the rendered application in a containing outer frame

  • 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.

type: String

The path to the HTML template file which should be used to render the inner content of the app


type: String

An Application window should define its own title definition logic which may be dynamic depending on its data

Application Example

This section provides a working example Application that could be defined in your game. When creating a module, or a UI component of a game system, you would pair this JavaScript code which defines the Application with an HTML template (options.template) as well as accompanying CSS rules to define how the HTML should be styled.

 * A simple demo application which displays each active player's impersonated Actor
 * Displays the portrait and health bar for that Actor

class PartySummary extends Application {

   * Define default options for the PartySummary application
  static get defaultOptions() {
    const options = super.defaultOptions;
    options.template = "public/modules/party-summary/templates/summary.html";
    options.width = 600;
    options.height = "auto";
    return options;

  /* -------------------------------------------- */

   * Return the data used to render the summary template
   * Get all the active users
   * The impersonated character for each player is available as user.character
   getData() {
    return game.users.entities.filter(u =>;

  /* -------------------------------------------- */

   * Add some event listeners to the UI to provide interactivity
   * Let's have the game highlight each player's token when their name is clicked on
  activateListeners(html) {

    html.find(".actor-name").click(ev => {

      // Get the actor which was clicked and the active token(s) for that actor
      let actorId = ev.currentTarget.parentElement.getAttribute("data-actor-id"),
          actor = game.actors.get(actorId),
          tokens = actor.getActiveTokens(true);

      // Highlight active token(s) by triggering the token's mouse-over handler
      for ( let t of tokens ) {

To render your party summary UI to the player, all that needs to be done is to create an instance of the application class and call it’s render function.

let ps = new PartySummary();