Skip to content

Option Slider

Extends SliderElement and implements ValueElement<T>.

The option slider can select options.

Builders:

  • <T>builder: The default builder.

Builder methods:

  • index: The index of the option to select
    • getter / setter
  • addOption: Adds an option.
  • onChange: The function to run when this slider is changed.
    • setter

Class methods:

  • addOption: Adds an option.

Example:

OptionSlider.<String>builder()
.addOption(Text.literal("Vanilla"), "vanilla")
.addOption(Text.literal("Chocolate"), "chocolate")
.index(1)
.onChange(self -> Main.LOGGER.info("You selected {}", self.getValue()))
.build();