export declare class ModalBuilder implements JSONEncodable<APIModalInteractionResponseCallbackData>

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

Constructors

Creates a new modal.

readonly
components : readonly (ActionRowBuilder | AnyModalComponentBuilder)[]

The components within this modal.

addLabelComponents() : this

Adds label components to this modal.

addTextDisplayComponents() : this

Adds text display components to this modal.

setCustomId(
customId: string
) : this

Sets the custom id of this modal.

setTitle(
title: string
) : this

Sets the title of this modal.

spliceComponents(
index: number
deleteCount: number
...components: AnyModalComponentBuilder[]
) : this

Removes, replaces, or inserts components for this modal.

Examples:Remove the first component:
modal.spliceComponents(0, 1);
Remove the first n components:
const n = 4;
modal.spliceComponents(0, n);
Remove the last component:
modal.spliceComponents(-1, 1);

toJSON(
validationOverride?: boolean
) : APIModalInteractionResponseCallbackData

Serializes this builder to API-compatible JSON data.Note that by disabling validation, there is no guarantee that the resulting object will be valid.