Skip to content

Styling Annotations

public @interface Style {
String value(); // inline CSS string
}

Applies inline CSS to the component’s root element. Applied on a class, styles the page container.

Example from the demo:

@UI("/home")
@Style("max-width: 900px; margin: auto;")
public class Home { ... }

@CssClasses (Target: TYPE, FIELD, PARAMETER)

Section titled “@CssClasses (Target: TYPE, FIELD, PARAMETER)”
public @interface CssClasses {
String value(); // space-separated class names
}

Adds CSS class names to the component’s root element.

@DivStyle (Target: TYPE, FIELD, PARAMETER)

Section titled “@DivStyle (Target: TYPE, FIELD, PARAMETER)”
public @interface DivStyle {
String value(); // inline CSS string
}

Applies inline CSS to the wrapper <div> around the element, rather than the element itself. Useful when you need to style the layout container rather than the component.

Mateu provides a StyleConstants class with predefined style values:

// Common usage
@Style(StyleConstants.CONTAINER) // centers content with max-width

Difference between @Style and @DivStyle:

AnnotationStyled element
@StyleThe component element itself
@DivStyleThe outer wrapper div