Skip to content

Element

A raw HTML element. Useful for injecting arbitrary markup into the component tree when no higher-level component fits the need.

new Element("div", Map.of("style", "background-color: green;"), "Hola!")
new Element(String name, Map<String, String> attributes, String content)
PropertyTypeDefaultDescription
nameStringHTML tag name (e.g. "div", "span", "p")
attributesMap<String, String>HTML attributes (e.g. style, class, data-*)
onMap<String, String>Event handlers
contentStringInner text or HTML content
styleStringInline CSS
cssClassesStringCSS class names
Form.builder()
.title("Custom element")
.content(List.of(
new Element("div",
Map.of("style", "background-color: green; padding: 1rem; border-radius: 4px;"),
"Hello from a raw div!"
),
new Element("p",
Map.of("style", "color: red; font-weight: bold;"),
"Warning: this is a raw paragraph."
)
))
.build()
Element.builder()
.name("span")
.attributes(Map.of("class", "highlight"))
.content("Highlighted text")
.style("font-size: 1.2rem;")
.build()

Element gives full control over the rendered HTML but bypasses Mateu’s component model. Prefer purpose-built components when one is available.