class CheckboxBuilder

declare class CheckboxBuilder extends ComponentBuilder<APICheckboxComponent>

A builder that creates API-compatible JSON data for checkboxes.

Constructors

constructor()

Creates a new checkbox from API data.

Examples:Creating a checkbox from an API data object:
const checkbox = new CheckboxBuilder({
	custom_id: 'accept_terms',
	default: false,
});
Creating a checkbox using setters and API data:
const checkbox = new CheckboxBuilder()
	.setCustomId('subscribe_newsletter')
	.setDefault(true);

readonly
data : Partial<APICheckboxComponent>

The API data associated with this component.

Inherited from: ComponentBuilder

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.

setDefault(
isDefault: boolean
) : this

Sets whether this checkbox is checked by default.

setId(
id: number
) : this

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

Inherited from: ComponentBuilder

Serializes this builder to API-compatible JSON data.