Skip to content

Radio Group

Extends Panel and implements ValueElement<T>.

The radio group contains toggle buttons and can select one of them.

Builders:

  • <T>builder: The default builder.

Builder methods:

  • index: The index of the option to select
    • getter / setter
  • addOption: Adds an option.
  • onSelect: The function to run when an option is selected.
    • setter

Example:

RadioGroup.<String>builder()
.addOption(Text.literal("Cookies"), "cookies")
.addOption(Text.literal("Oreos"), "oreos")
.onSelected(self -> Main.LOGGER.info("You selected {}", self.getValue()))
.build();