ModalBuilder

export declare class ModalBuilder implements JSONEncodable<APIModalInteractionResponseCallbackData>
export declare class ModalBuilder implements JSONEncodable<APIModalInteractionResponseCallbackData>
A builder that creates API-compatible JSON data for modals.
constructor(data?)
Creates a new modal from API data.
NameTypeOptionalDescription
dataPartial<APIModalInteractionResponseCallbackData>Yes
The API data to create this modal with
The components within this modal.
The API data associated with this modal.
addComponents(components):this
Adds components to this modal.
setComponents(components):this
Sets components for this modal.
NameTypeOptionalDescription
componentsRestOrArray<ActionRowBuilder<ModalActionRowComponentBuilder>>No
The components to set
setCustomId(customId):this
Sets the custom id of this modal.
NameTypeOptionalDescription
customIdstringNo
The custom id to use
setTitle(title):this
Sets the title of this modal.
NameTypeOptionalDescription
titlestringNo
The title to use
Serializes this builder to API-compatible JSON data.
Remarks
This method runs validations on the data before serializing it. As such, it may throw an error if the data is invalid.