class CheckboxGroupBuilder

declare class CheckboxGroupBuilder extends ComponentBuilder<APICheckboxGroupComponent>

A builder that creates API-compatible JSON data for checkbox groups.

Constructors

constructor()

Creates a new checkbox group from API data.

Examples:Creating a checkbox group from an API data object:
const checkboxGroup = new CheckboxGroupBuilder({
	custom_id: 'select_options',
	options: [
		{ label: 'Option 1', value: 'option_1' },
		{ label: 'Option 2', value: 'option_2' },
	],
});
Creating a checkbox group using setters and API data:
const checkboxGroup = new CheckboxGroupBuilder()
	.setCustomId('choose_items')
	.setOptions([
		{ label: 'Item A', value: 'item_a' },
		{ label: 'Item B', value: 'item_b' },
	])
	.setMinValues(1)
	.setMaxValues(2);

The API data associated with this component.

Inherited from: ComponentBuilder

readonly
options : CheckboxGroupOptionBuilder[]

The options within this checkbox group.

Adds options to this checkbox group.

clearId() : this

Clears the id of this component, defaulting to a default incremented id.

Inherited from: ComponentBuilder

setCustomId(
customId: string
) : this

Sets the custom id of this checkbox group.

setId(
id: number
) : this

Sets the id (not the custom id) for this component.

Inherited from: ComponentBuilder

setMaxValues(
maxValues: number
) : this

Sets the maximum number of options that can be selected.

setMinValues(
minValues: number
) : this

Sets the minimum number of options that must be selected.

Sets the options for this checkbox group.

setRequired(
required: boolean
) : this

Sets whether selecting options is required.

spliceOptions() : this

Removes, replaces, or inserts options for this checkbox group.

Serializes this builder to API-compatible JSON data.