ActionRowBuilder
ActionRowBuilder is a generic container that holds interactive components (buttons, select menus, or text inputs in modals). Each message can have up to 5 action rows.
Import
Section titled “Import”import { ActionRowBuilder } from "lunibee";import { ActionRowBuilder } from "lunibee";Generic Type Parameter
Section titled “Generic Type Parameter”ActionRowBuilder<T> is typed to the component it will hold. This provides type-safe addComponents() calls:
import { ActionRowBuilder, ButtonBuilder, StringSelectBuilder } from "lunibee";
const buttonRow = new ActionRowBuilder<ButtonBuilder>();const selectRow = new ActionRowBuilder<StringSelectBuilder>();import { ActionRowBuilder, ButtonBuilder, StringSelectBuilder } from "lunibee";
const buttonRow = new ActionRowBuilder();const selectRow = new ActionRowBuilder();Methods
Section titled “Methods”addComponents(...components)
Section titled “addComponents(...components)”Adds one or more components to the row (max 5 buttons or 1 select menu per row).
const row = new ActionRowBuilder<ButtonBuilder>().addComponents( new ButtonBuilder().setCustomId("a").setLabel("A").setStyle(1), new ButtonBuilder().setCustomId("b").setLabel("B").setStyle(2),);const row = new ActionRowBuilder().addComponents( new ButtonBuilder().setCustomId("a").setLabel("A").setStyle(1), new ButtonBuilder().setCustomId("b").setLabel("B").setStyle(2),);setComponents(...components)
Section titled “setComponents(...components)”Replaces all components with a new set.
toJSON()
Section titled “toJSON()”Serializes to a raw Discord API-compatible action row object.
Examples
Section titled “Examples”Three-button row
import { ActionRowBuilder, ButtonBuilder, ButtonStyle } from "lunibee";
const row = new ActionRowBuilder<ButtonBuilder>().addComponents( new ButtonBuilder().setCustomId("prev").setLabel("◀ Previous").setStyle(ButtonStyle.Secondary), new ButtonBuilder().setCustomId("stop").setLabel("⏹ Stop").setStyle(ButtonStyle.Danger), new ButtonBuilder().setCustomId("next").setLabel("Next ▶").setStyle(ButtonStyle.Secondary),);await channel.send({ content: "Page 1 of 5", components: [row] });import { ActionRowBuilder, ButtonBuilder, ButtonStyle } from "lunibee";
const row = new ActionRowBuilder().addComponents( new ButtonBuilder().setCustomId("prev").setLabel("◀ Previous").setStyle(ButtonStyle.Secondary), new ButtonBuilder().setCustomId("stop").setLabel("⏹ Stop").setStyle(ButtonStyle.Danger), new ButtonBuilder().setCustomId("next").setLabel("Next ▶").setStyle(ButtonStyle.Secondary),);await channel.send({ content: "Page 1 of 5", components: [row] });Select menu row
import { ActionRowBuilder, StringSelectBuilder } from "lunibee";
const row = new ActionRowBuilder<StringSelectBuilder>().addComponents( new StringSelectBuilder() .setCustomId("pick_role") .setPlaceholder("Pick a role…") .addOptions( { label: "Developer", value: "dev", emoji: "💻" }, { label: "Designer", value: "design", emoji: "🎨" }, ),);await channel.send({ content: "Choose your role:", components: [row] });import { ActionRowBuilder, StringSelectBuilder } from "lunibee";
const row = new ActionRowBuilder().addComponents( new StringSelectBuilder() .setCustomId("pick_role") .setPlaceholder("Pick a role…") .addOptions( { label: "Developer", value: "dev", emoji: "💻" }, { label: "Designer", value: "design", emoji: "🎨" }, ),);await channel.send({ content: "Choose your role:", components: [row] });Modal with text input (using ActionRowBuilder)
import { ActionRowBuilder, TextInputBuilder, TextInputStyle, ModalBuilder } from "lunibee";
const modal = new ModalBuilder() .setCustomId("feedback") .setTitle("Send Feedback") .addComponents( new ActionRowBuilder<TextInputBuilder>().addComponents( new TextInputBuilder() .setCustomId("message") .setLabel("Your feedback") .setStyle(TextInputStyle.Paragraph), ), );await interaction.showModal(modal);import { ActionRowBuilder, TextInputBuilder, TextInputStyle, ModalBuilder } from "lunibee";
const modal = new ModalBuilder() .setCustomId("feedback") .setTitle("Send Feedback") .addComponents( new ActionRowBuilder().addComponents( new TextInputBuilder() .setCustomId("message") .setLabel("Your feedback") .setStyle(TextInputStyle.Paragraph), ), );await interaction.showModal(modal);