ActionRowBuilder

export declare class ActionRowBuilder extends ComponentBuilder<APIActionRowComponent<APIActionRowComponentTypes>>
export declare class ActionRowBuilder extends ComponentBuilder<APIActionRowComponent<APIActionRowComponentTypes>>
A builder that creates API-compatible JSON data for action rows.
constructor(data?)
Creates a new action row from API data.
Example
Creating an action row from an API data object:
const actionRow = new ActionRowBuilder({
components: [
{
custom_id: "custom id",
label: "Type something",
style: TextInputStyle.Short,
type: ComponentType.TextInput,
},
],
});
const actionRow = new ActionRowBuilder({
components: [
{
custom_id: "custom id",
label: "Type something",
style: TextInputStyle.Short,
type: ComponentType.TextInput,
},
],
});
Example
Creating an action row using setters and API data:
const actionRow = new ActionRowBuilder({
components: [
{
custom_id: "custom id",
label: "Click me",
style: ButtonStyle.Primary,
type: ComponentType.Button,
},
],
})
.addComponents(button2, button3);
const actionRow = new ActionRowBuilder({
components: [
{
custom_id: "custom id",
label: "Click me",
style: ButtonStyle.Primary,
type: ComponentType.Button,
},
],
})
.addComponents(button2, button3);
NameTypeOptionalDescription
dataPartial<APIActionRowComponent<APIActionRowComponentTypes>>YesThe API data to create this action row with
Readonly
components:readonly AnyActionRowComponentBuilder[]
The components within this action row.
addChannelSelectMenuComponent(input):this
Adds a channel select menu component to this action row.
NameTypeOptionalDescription
inputAPIChannelSelectComponent | ChannelSelectMenuBuilder | ((builder: ChannelSelectMenuBuilder) => ChannelSelectMenuBuilder)NoA function that returns a component builder or an already built builder
addComponents(...input):this
Generically add any type of component to this action row, only takes in an instance of a component builder.
NameTypeOptionalDescription
...inputRestOrArray<AnyActionRowComponentBuilder>NoNone
addDangerButtonComponents(...input):this
Adds danger button components to this action row.
NameTypeOptionalDescription
...inputRestOrArray<APIButtonComponentWithCustomId | DangerButtonBuilder | ((builder: DangerButtonBuilder) => DangerButtonBuilder)>NoNone
addLinkButtonComponents(...input):this
Adds URL button components to this action row.
NameTypeOptionalDescription
...inputRestOrArray<APIButtonComponentWithURL | LinkButtonBuilder | ((builder: LinkButtonBuilder) => LinkButtonBuilder)>NoThe buttons to add
addMentionableSelectMenuComponent(input):this
Adds a mentionable select menu component to this action row.
NameTypeOptionalDescription
inputAPIMentionableSelectComponent | MentionableSelectMenuBuilder | ((builder: MentionableSelectMenuBuilder) => MentionableSelectMenuBuilder)NoA function that returns a component builder or an already built builder
addPremiumButtonComponents(...input):this
Adds SKU id button components to this action row.
NameTypeOptionalDescription
...inputRestOrArray<APIButtonComponentWithSKUId | PremiumButtonBuilder | ((builder: PremiumButtonBuilder) => PremiumButtonBuilder)>NoThe buttons to add
addPrimaryButtonComponents(...input):this
Adds primary button components to this action row.
NameTypeOptionalDescription
...inputRestOrArray<APIButtonComponentWithCustomId | PrimaryButtonBuilder | ((builder: PrimaryButtonBuilder) => PrimaryButtonBuilder)>NoThe buttons to add
addRoleSelectMenuComponent(input):this
Adds a role select menu component to this action row.
NameTypeOptionalDescription
inputAPIRoleSelectComponent | RoleSelectMenuBuilder | ((builder: RoleSelectMenuBuilder) => RoleSelectMenuBuilder)NoA function that returns a component builder or an already built builder
addSecondaryButtonComponents(...input):this
Adds secondary button components to this action row.
NameTypeOptionalDescription
...inputRestOrArray<APIButtonComponentWithCustomId | SecondaryButtonBuilder | ((builder: SecondaryButtonBuilder) => SecondaryButtonBuilder)>NoThe buttons to add
addStringSelectMenuComponent(input):this
Adds a string select menu component to this action row.
NameTypeOptionalDescription
inputAPIStringSelectComponent | StringSelectMenuBuilder | ((builder: StringSelectMenuBuilder) => StringSelectMenuBuilder)NoA function that returns a component builder or an already built builder
addSuccessButtonComponents(...input):this
Adds success button components to this action row.
NameTypeOptionalDescription
...inputRestOrArray<APIButtonComponentWithCustomId | SuccessButtonBuilder | ((builder: SuccessButtonBuilder) => SuccessButtonBuilder)>NoThe buttons to add
addTextInputComponent(input):this
Adds a text input component to this action row.
NameTypeOptionalDescription
inputAPITextInputComponent | TextInputBuilder | ((builder: TextInputBuilder) => TextInputBuilder)NoA function that returns a component builder or an already built builder
addUserSelectMenuComponent(input):this
Adds a user select menu component to this action row.
NameTypeOptionalDescription
inputAPIUserSelectComponent | UserSelectMenuBuilder | ((builder: UserSelectMenuBuilder) => UserSelectMenuBuilder)NoA function that returns a component builder or an already built builder
spliceComponents(index, deleteCount, ...components):this
Removes, replaces, or inserts components for this action row.
Remarks
This method behaves similarly to Array.prototype.splice().It's useful for modifying and adjusting order of the already-existing components of an action row.
Example
Remove the first component:
actionRow.spliceComponents(0, 1);
actionRow.spliceComponents(0, 1);
Example
Remove the first n components:
const n = 4;
actionRow.spliceComponents(0, n);
const n = 4;
actionRow.spliceComponents(0, n);
Example
Remove the last component:
actionRow.spliceComponents(-1, 1);
actionRow.spliceComponents(-1, 1);
NameTypeOptionalDescription
indexnumberNoThe index to start at
deleteCountnumberNoThe number of components to remove
...componentsAnyActionRowComponentBuilder[]NoThe replacing component objects
Serializes this builder to API-compatible JSON data.Note that by disabling validation, there is no guarantee that the resulting object will be valid.
NameTypeOptionalDescription
validationOverridebooleanYesForce validation to run/not run regardless of your global preference