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
idStringOptional component ID
labelStringButton text
iconOnLeftStringIcon name rendered before the label
iconOnRightStringIcon name rendered after the label
imageStringImage src (alternative to icon)
colorButtonColornormalColor theme
variantButtonVariantVisual variant
buttonStyleButtonStyleStyle (primary, tertiary, …)
sizeButtonSizesmall, medium (default), large
autofocusbooleanfalseAuto-focuses this button
disabledbooleanfalseDisables the button
actionIdStringAction identifier sent to the server on click
runnableRunnableInline action (runs on the server)
callableCallable<?>Inline action with return value
styleStringInline CSS
cssClassesStringCSS 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()
))
...