Skip to content

First app

This tutorial is a slower introduction than the quickstart.

If you want to build something real first, go to the Quickstart.


@UI("")
@Title("My first Mateu app")
@Style(StyleConstants.CONTAINER)
public class Home {
}

This defines a screen at the root path (/) with a title and a container-style layout.


String name;

Mateu uses fields as UI state.

This automatically creates a text input field in the UI.


@NotEmpty
String name;

Validation annotations are reflected directly in the UI.

Now the field is required.


@Button
public Message greet() {
return new Message("Hello " + name);
}

Actions define behavior.

This creates a button that:

  • reads the current state (name)
  • executes the method
  • shows the returned message

With just this code, Mateu generates a working UI:

  • an input field for name
  • validation from @NotEmpty
  • a button bound to the greet action
  • a message shown as feedback

Result of the first app


You defined:

  • state → name
  • validation → @NotEmpty
  • behavior → greet()

Mateu turned that into a complete UI automatically.