Creates a new select menu from API data.
Optional
data: Partial<APIStringSelectComponent>The API data to create this select menu with
Creating a select menu from an API data object:
const selectMenu = new StringSelectMenuBuilder({
custom_id: 'a cool select menu',
placeholder: 'select an option',
max_values: 2,
options: [
{ label: 'option 1', value: '1' },
{ label: 'option 2', value: '2' },
{ label: 'option 3', value: '3' },
],
});
Readonly
dataThe API data associated with this component.
Readonly
optionsThe options within this select menu.
Adds options to this select menu.
The options to add
Clears the id of this component, defaulting to a default incremented id.
Sets the custom id for this select menu.
The custom id to use
Sets whether this select menu is disabled.
Optional
disabled: booleanWhether this select menu is disabled
Sets the id (not the custom id) for this component.
The id for this component
Sets the maximum values that must be selected in the select menu.
The maximum values that must be selected
Sets the minimum values that must be selected in the select menu.
The minimum values that must be selected
Sets the options for this select menu.
The options to set
Sets the placeholder for this select menu.
The placeholder to use
Removes, replaces, or inserts options for this select menu.
The index to start at
The number of options to remove
The replacing option objects or builders
This method behaves similarly to Array.prototype.splice(). It's useful for modifying and adjusting the order of existing options.
Serializes this builder to API-compatible JSON data.
A builder that creates API-compatible JSON data for string select menus.