class CheckboxBuilder
extends
ComponentBuilder<APICheckboxComponent>declare class CheckboxBuilder extends ComponentBuilder<APICheckboxComponent>A builder that creates API-compatible JSON data for checkboxes.
Constructors
constructor(data?: Partial<APICheckboxComponent>)
data?: Partial<APICheckboxComponent>
Creates a new checkbox from API data.
Examples:Creating a checkbox from an API data object:Creating a checkbox using setters and API data:
const checkbox = new CheckboxBuilder({
custom_id: 'accept_terms',
default: false,
});const checkbox = new CheckboxBuilder()
.setCustomId('subscribe_newsletter')
.setDefault(true);readonlydata : Partial<APICheckboxComponent>
The API data associated with this component.
Inherited from: ComponentBuilder
Clears the id of this component, defaulting to a default incremented id.
Inherited from: ComponentBuilder
setCustomId(customId: string) : this
customId: string
Sets the custom id of this checkbox.
setDefault(isDefault: boolean) : this
isDefault: boolean
Sets whether this checkbox is checked by default.
setId(id: number) : this
id: number
Sets the id (not the custom id) for this component.
Inherited from: ComponentBuilder
toJSON() : APICheckboxComponent
Serializes this builder to API-compatible JSON data.