The singleton collection of Folder documents which exist within the active World. This Collection is accessible within the Game object as game.folders.


Folder The Folder document

Hierarchy (view full)


_expanded: {} = {}

Track which Folders are currently expanded in the UI

Type declaration

    apps: Application[]

    An Array of application references which will be automatically updated when the collection content changes

    invalidDocumentIds: Set<string> = ...

    Record the set of document ids where the Document was not initialized because of invalid source data

    documentName: string = "Folder"


    • get folders(): Collection<string, Folder>
    • Reference the set of Folders which contain documents in this collection

      Returns Collection<string, Folder>

    • get directory(): DocumentDirectory
    • Return a reference to the SidebarDirectory application for this WorldCollection.

      Returns DocumentDirectory

    • get documentClass(): typeof Document
    • A reference to the Document class definition which is contained within this DocumentCollection.

      Returns typeof Document

    • get documentName(): any
    • Returns any

      Inherit Doc

    • get name(): string
    • The Collection class name

      Returns string

    • get instance(): WorldCollection
    • Return a reference to the singleton instance of this WorldCollection, or null if it has not yet been created.

      Returns WorldCollection

    • get registeredSheets(): DocumentSheet[]
    • Return an array of currently registered sheet classes for this Document type.

      Returns DocumentSheet[]



    • Parameters

      • action: any
      • documents: any
      • result: any
      • operation: any
      • user: any

      Returns void

    • Parameters

      • force: any
      • options: {} = {}

        Returns void

      • Import a Document from a Compendium collection, adding it to the current World.


        • pack: CompendiumCollection

          The CompendiumCollection instance from which to import

        • id: string

          The ID of the compendium entry to import

        • Optional updateData: any = {}

          Optional additional data used to modify the imported Document before it is created

        • Optional options: any = {}

          Optional arguments passed to the WorldCollection#fromCompendium and Document.create methods

        Returns Promise<Document>

        The imported Document instance

      • Apply data transformations when importing a Document from a Compendium pack


        • document: any

          The source Document, or a plain data object

        • Optional options: FromCompendiumOptions = {}

          Additional options which modify how the document is imported

        Returns any

        The processed data ready for world Document creation

      • Instantiate a Document for inclusion in the Collection.


        • data: any

          The Document data.

        • Optional context: any = {}

          Document creation context.

        Returns Document

      • Obtain a temporary Document instance for a document id which currently has invalid source data.


        • id: string

          A document ID with invalid source data.

        • Optional options: {
              strict: boolean;
          } = {}

          Additional options to configure retrieval.

          • strict: boolean

            Throw an Error if the requested ID is not in the set of invalid IDs for this collection.

        Returns Document

        An in-memory instance for the invalid Document


        If strict is true and the requested ID is not in the set of invalid IDs for this collection.

      • Get an element from the DocumentCollection by its ID.


        • id: string

          The ID of the Document to retrieve.

        • Optional options: {
              strict: boolean;
              invalid: boolean;
          } = {}

          Additional options to configure retrieval.

          • strict: boolean

            Throw an Error if the requested Document does not exist.

          • invalid: boolean

            Allow retrieving an invalid Document.

        Returns Document


        If strict is true and the Document cannot be found.

      • Parameters

        • id: any
        • document: any

        Returns void

        Inherit Doc

      • Find all Documents which match a given search term using a full-text search against their indexed HTML fields and their name. If filters are provided, results are filtered to only those that match the provided values.


        • search: {
              query: string;
              filters: FieldFilter[];
              exclude: string[];

          An object configuring the search

          • query: string

            A case-insensitive search string

          • filters: FieldFilter[]

            An array of filters to apply

          • exclude: string[]

            An array of document IDs to exclude from search results

        Returns string[]

      • Update all objects in this DocumentCollection with a provided transformation. Conditionally filter to only apply to Entities which match a certain condition.


        • transformation: any

          An object of data or function to apply to all matched objects

        • condition: Function = null

          A function which tests whether to target each object

        • Optional options: any = {}

          Additional options passed to Document.updateDocuments

        Returns Promise<Document[]>

        An array of updated data once the operation is complete

      • Private

        Refresh the display of any active JournalSheet instances where the folder list will change.

        Returns void

      • Register a Document sheet class as a candidate which can be used to display Documents of a given type. See DocumentSheetConfig.registerSheet for details.


        • Rest ...args: any[]

          Arguments forwarded to the DocumentSheetConfig.registerSheet method

        Returns void


        Example: Register a new ActorSheet subclass for use with certain Actor types.

        Actors.registerSheet("dnd5e", ActorSheet5eCharacter, { types: ["character], makeDefault: true });
      • Unregister a Document sheet class, removing it from the list of available sheet Applications to use. See DocumentSheetConfig.unregisterSheet for detauls.


        • Rest ...args: any[]

          Arguments forwarded to the DocumentSheetConfig.unregisterSheet method

        Returns void


        Example: Deregister the default ActorSheet subclass to replace it with others.

        Actors.unregisterSheet("core", ActorSheet);
      • Get the searchable fields for a given document or index, based on its data model


        • documentName: string

          The document type name

        • Optional documentSubtype: string = ""

          The document subtype name

        • Optional isEmbedded: boolean = false

          Whether the document is an embedded object

        Returns Set<string>

        The dot-delimited property paths of searchable fields