Discord.https - v3.0.16
    Preparing search index...

    Class ModalBuilder

    A builder that creates API-compatible JSON data for modals.

    Implements

    Index

    Constructors

    Properties

    components: (
        TextDisplayBuilder
        | LabelBuilder
        | ActionRowBuilder<TextInputBuilder>
    )[]

    The components within this modal.

    The API data associated with this modal.

    Methods

    • Sets the custom id of this modal.

      Parameters

      • customId: string

        The custom id to use

      Returns this

    • Sets the title of this modal.

      Parameters

      • title: string

        The title to use

      Returns this

    • Removes, replaces, or inserts labels for this modal.

      Parameters

      Returns this

      This method behaves similarly to Array.prototype.splice(). The maximum amount of labels that can be added is 5.

      It's useful for modifying and adjusting order of the already-existing labels of a modal.

      Remove the first label:

      modal.spliceLabelComponents(0, 1);
      

      Remove the first n labels:

      const n = 4;
      modal.spliceLabelComponents(0, n);

      Remove the last label:

      modal.spliceLabelComponents(-1, 1);