Skip to content

Label

Implementation of Discord’s Label component as a Luau builder. Labels associate a label and description with a single interactive component. Recommended over ActionRow in modals.

https://docs.discord.com/developers/components/reference#label

Label.label  :: string?

The label text; max 45 characters.

Label.description  :: string?

Additional description text; max 100 characters.

Label.component  :: any?

A component to associate with the label.

Label.required  :: boolean?

Whether this component is required (defaults to true).

Label : setLabel ( label )  -> Label

Sets the label text. Max 45 characters.

Parameters

label: string

Returns

Label
Label : setDescription ( description )  -> Label

Sets the description text. Max 100 characters.

Parameters

description: string

Returns

Label
Label : setComponent ( component )  -> Label

Sets the interactive component to associate with this label.

Parameters

component: ComponentObjects

Returns

Label
Label : setRequired ( required )  -> Label

Sets whether this component is required in a modal.

Parameters

required: boolean

Returns

Label
Label : build ( )  -> JSON

Responsible for building the Label JSON that can be parsed by the Discord API.

Returns

JSON
Label . new ( resource )  -> Label

Responsible for creating a new Label.

Parameters

resource: {
label: string?,
description: string?,
component: apiTypes.ComponentObjects?,
required: boolean?,
}

Returns

Label