Skip to content
Anjunar/ DOCS

Button

The pulse of your app.
Interaction
A button is small, but it carries responsibility.
In Scala JS UI 1.0 the action stays visible in the template: label, event, and surrounding context sit next to each other. That keeps simple buttons easy to read and leaves room for more complex workflows later.
Standard button
A focused click target with direct event binding. Ideal for clear, self-contained actions.
Buttons are the heart of interaction. They are not just click targets; they bring your app to life.
Action group
Several buttons may sit close together as long as their intent remains distinguishable.
State
The button says what happens
A good label describes the next action, not the technical implementation behind it.
Event
onClick stays local
The DSL keeps trigger and reaction visible in the same place.
Feedback
Actions need a response
After the click, the interface should show something visible: a message, status, navigation, or data update.
The simplicity of the DSL
The core stays intentionally small: create the button, bind the handler, done.
scala
button("Click me") { onClick { _ => println("Clicked") } }