Skip to content

Toggle Button

Extends Button and implements ValueElement<Boolean>.

The toggle button can be pressed to toggle between on and off.

Builders:

Builder methods:

  • value: The value.
    • getter / setter
  • onColor: The text color when this toggle button is on.
    • getter / setter
  • offColor: The text color when this toggle button is off.
    • getter / setter
  • colorCoded: Sets the on color to green and the off color to red.
  • valueFormatter: The value formatter to use.
    • setter

Example:

ToggleButton.builder()
.value(true)
.colorCoded()
.valueFormatter(ValueFormatters.BOOLEAN_YES_NO)
.renderOperations(
RenderOperations.BUTTON_RENDER,
RenderOperations.VALUE_RENDER
)
.build();