declare class CheckboxGroupBuilder extends ComponentBuilder<APICheckboxGroupComponent>A builder that creates API-compatible JSON data for checkbox groups.
Constructors
constructor(data?: Partial<APICheckboxGroupComponent>)
Creates a new checkbox group from API data.
const checkboxGroup = new CheckboxGroupBuilder({
custom_id: 'select_options',
options: [
{ label: 'Option 1', value: 'option_1' },
{ label: 'Option 2', value: 'option_2' },
],
});const checkboxGroup = new CheckboxGroupBuilder()
.setCustomId('choose_items')
.setOptions([
{ label: 'Item A', value: 'item_a' },
{ label: 'Item B', value: 'item_b' },
])
.setMinValues(1)
.setMaxValues(2);readonlydata : Partial<APICheckboxGroupComponent>
The API data associated with this component.
Inherited from: ComponentBuilder
readonlyoptions : CheckboxGroupOptionBuilder[]
The options within this checkbox group.
addOptions(...options: RestOrArray<APICheckboxGroupOption | CheckboxGroupOptionBuilder>) : this
Adds options to this checkbox group.
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.
setOptions(...options: RestOrArray<APICheckboxGroupOption | CheckboxGroupOptionBuilder>) : this
Sets the options for this checkbox group.
setRequired(required: boolean) : this
Sets whether selecting options is required.
spliceOptions(index: numberdeleteCount: number...options: RestOrArray<APICheckboxGroupOption | CheckboxGroupOptionBuilder>) : this
Removes, replaces, or inserts options for this checkbox group.
toJSON() : APICheckboxGroupComponent
Serializes this builder to API-compatible JSON data.