Skip to content

Button

A clickable action element. When placed inside a Form’s toolbar or buttons list it sends an action to the server. When used as a standalone component inside a layout it can trigger an action by actionId or execute a Runnable/Callable inline.

Button.builder()
.label("Do something")
.actionId("my_action")
.build()
PropertyTypeDefaultDescription
idString—Optional component ID
labelString—Button text
iconOnLeftString—Icon name rendered before the label
iconOnRightString—Icon name rendered after the label
imageString—Image src (alternative to icon)
colorButtonColornormalColor theme
variantButtonVariant—Visual variant
buttonStyleButtonStyle—Style (primary, tertiary, …)
sizeButtonSize—small, medium (default), large
autofocusbooleanfalseAuto-focuses this button
disabledbooleanfalseDisables the button
actionIdString—Action identifier sent to the server on click
runnableRunnable—Inline action (runs on the server)
callableCallable<?>—Inline action with return value
styleString—Inline CSS
cssClassesString—CSS class names
ValueDescription
primaryFilled / prominent button
tertiaryBorderless / text button
(default)Outlined button
Button.builder().label("Small").size(ButtonSize.small).build()
Button.builder().label("Default").build()
Button.builder().label("Large").size(ButtonSize.large).build()
Button.builder()
.label("Back")
.iconOnLeft(IconKey.ChevronLeft.iconName)
.build()
Button.builder()
.label("Next")
.iconOnRight(IconKey.ChevronRight.iconName)
.build()
Button.builder()
.label("Cannot click")
.disabled(true)
.build()
// label + actionId
new Button("Save", "save_action")
// label only (actionId derived from label)
new Button("Save")
// inline Runnable
new Button("Refresh", () -> loadData())
// inline Callable (return value becomes the server response)
new Button("Calculate", () -> calculate())
  • toolbar (Form.toolbar) — secondary actions shown top-right of the form header
  • buttons (Form.buttons) — primary actions shown at the bottom of the form
Form.builder()
.toolbar(List.of(
Button.builder().label("Export").actionId("export").build()
))
.buttons(List.of(
Button.builder().label("Save").actionId("save").buttonStyle(ButtonStyle.primary).build(),
Button.builder().label("Cancel").actionId("cancel").build()
))
...