StringSelectMenuBuilder error

error:
data.components[0].components[1][COMPONENT_LAYOUT_WITDH_EXCEEDED]: the specified component exceeds the maximum witdh
data.components[0].components[1][COMPONENT_LAYOUT_WITDH_EXCEEDED]: the specified component exceeds the maximum witdh
Select menu code
const selectMenuOptions = pshipData.pshipTypes.map(category => (
new StringSelectMenuOptionBuilder()
.setLabel(category.categoryName)
.setValue(category.categoryName)
));
const selectMenu = new StringSelectMenuBuilder()
.setCustomId('category_select')
.setPlaceholder('Select a category')
.addOptions(...selectMenuOptions);

// a button to save and create
const button = new ButtonBuilder()
.setCustomId('save_button')
.setLabel('Save & Create')
.setStyle(ButtonStyle.Success);

// an action row with select menu and button
const row = new ActionRowBuilder()
.setComponents(selectMenu, button);
const selectMenuOptions = pshipData.pshipTypes.map(category => (
new StringSelectMenuOptionBuilder()
.setLabel(category.categoryName)
.setValue(category.categoryName)
));
const selectMenu = new StringSelectMenuBuilder()
.setCustomId('category_select')
.setPlaceholder('Select a category')
.addOptions(...selectMenuOptions);

// a button to save and create
const button = new ButtonBuilder()
.setCustomId('save_button')
.setLabel('Save & Create')
.setStyle(ButtonStyle.Success);

// an action row with select menu and button
const row = new ActionRowBuilder()
.setComponents(selectMenu, button);
8 Replies
d.js toolkit
d.js toolkit3mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
Void
Void3mo ago
I'm trying to give options for some categoryNames from my db
ahmood
ahmood3mo ago
an action row can have only 1 select menu or up to 5 buttons
Void
Void3mo ago
And if I want to add both? There's only one select menu and 1 button
ahmood
ahmood3mo ago
make another action row
Void
Void3mo ago
Let me try
ahmood
ahmood3mo ago
one for the select menu, one for the button
Void
Void3mo ago
Worked! Ty