class LabelBuilder

export declare class LabelBuilder extends ComponentBuilder<APILabelComponent>

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

Constructors

constructor()

Creates a new label.

Examples:Creating a label from an API data object:
const label = new LabelBuilder({
	label: "label",
	component,
});
Creating a label using setters and API data:
const label = new LabelBuilder({
	label: 'label',
	component,
}).setContent('new text');

clearDescription() : this

Clears the description for this label.

clearId() : this

Clears the id of this component, defaulting to a default incremented id.

Inherited from: ComponentBuilder

setDescription(
description: string
) : this

Sets the description for this label.

setId(
id: number
) : this

Sets the id of this component.

Inherited from: ComponentBuilder

setLabel(
label: string
) : this

Sets the label for this label.

setStringSelectMenuComponent() : this

Sets a string select menu component to this label.

setTextInputComponent() : this

Sets a text input component to this label.

toJSON(
validationOverride?: boolean
) : APILabelComponent

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