Preview environment
export declare class ModalBuilder implements JSONEncodable<APIModalInteractionResponseCallbackData>

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

The components within this modal.

The API data associated with this modal.

Adds action rows to this modal.

addLabelComponents() : this

Adds label components to this modal.

addTextDisplayComponents() : this

Adds text display components to this modal.

deprecated
setComponents() : this

Sets components for this modal.

setCustomId(
customId: string
) : this

Sets the custom id of this modal.

setLabelComponents() : this

Sets the labels for this modal.

setTitle(
title: string
) : this

Sets the title of this modal.

spliceLabelComponents(
index: number
deleteCount: number
...labels: (APILabelComponent | LabelBuilder | ((builder: LabelBuilder) => LabelBuilder))[]
) : this

Removes, replaces, or inserts labels for this modal.

Examples: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);

Serializes this builder to API-compatible JSON data.