class StringSelectMenuBuilder

export declare class StringSelectMenuBuilder extends BaseSelectMenuBuilder<APIStringSelectComponent>

A builder that creates API-compatible JSON data for string select menus.

Constructors

constructor()

Creates a new select menu from API data.

Examples: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' },
	],
});
Creating a select menu using setters and API data:
const selectMenu = new StringSelectMenuBuilder({
	custom_id: 'a cool select menu',
})
	.setMinValues(1)
	.addOptions({
		label: 'Catchy',
		value: 'catch',
	});

readonly
data : Partial<SelectMenuType>

The API data associated with this component.

Inherited from: ComponentBuilder

readonly
options : StringSelectMenuOptionBuilder[]

The options within this select menu.

Adds options to this select menu.

setCustomId(
customId: string
) : this

Sets the custom id for this select menu.

Inherited from: BaseSelectMenuBuilder

setDisabled(
disabled?: boolean
) : this

Sets whether this select menu is disabled.

Inherited from: BaseSelectMenuBuilder

setMaxValues(
maxValues: number
) : this

Sets the maximum values that must be selected in the select menu.

Inherited from: BaseSelectMenuBuilder

setMinValues(
minValues: number
) : this

Sets the minimum values that must be selected in the select menu.

Inherited from: BaseSelectMenuBuilder

Sets the options for this select menu.

setPlaceholder(
placeholder: string
) : this

Sets the placeholder for this select menu.

Inherited from: BaseSelectMenuBuilder

spliceOptions() : this

Removes, replaces, or inserts options for this select menu.

Examples:Remove the first option:
selectMenu.spliceOptions(0, 1);
Remove the first n option:
const n = 4;
selectMenu.spliceOptions(0, n);
Remove the last option:
selectMenu.spliceOptions(-1, 1);

Serializes this builder to API-compatible JSON data.