class RadioGroupBuilder

declare class RadioGroupBuilder extends ComponentBuilder<APIRadioGroupComponent>

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

Constructors

constructor()

Creates a new radio group from API data.

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

The API data associated with this component.

Inherited from: ComponentBuilder

readonly
options : RadioGroupOptionBuilder[]

The options within this radio group.

addOptions() : this

Adds options to this radio 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 radio group.

setId(
id: number
) : this

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

Inherited from: ComponentBuilder

Sets the options for this radio group.

setRequired(
required: boolean
) : this

Sets whether selecting options is required.

spliceOptions() : this

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

Serializes this builder to API-compatible JSON data.