Demos /

Text & structure

Working framework components, paired with the Java that composes them.

Div

Group related components without inserting trusted HTML.

A composed block

Java composition
new Div().withChild(new Paragraph("A composed block"));

Paragraph

Plain text is escaped, including angle brackets and ampersands.

Java < HTML & back again

Java composition
new Paragraph("Java < HTML & back again");

TextNode

Compose inline text with another component.

Use RenderContext

Java composition
new Paragraph().withChild(new TextNode("Use " )).withChild(Code.inline("RenderContext"));

RawHtml

Only application-owned trusted markup belongs in RawHtml.

Trusted application markup

Java composition
new RawHtml("<p><strong>Trusted application markup</strong></p>");

Markdown

Render structured prose using safe Markdown defaults.

Compose, then render.

  • Java
  • HTML
Java composition
new Markdown("**Compose**, then render.\n\n- Java\n- HTML");

Code

Inline and titled, language-marked block code.

SlotKey<String>
Render.java
page.render(context);
Java composition
new Div().withChild(Code.inline("SlotKey<String>")).withChild(Code.block("page.render(context);").withLanguage("java").withTitle("Render.java"));

Blockquote

A quotation within surrounding content.

Keep request data in the render context.

Java composition
Blockquote.create("Keep request data in the render context.");

Divider

Horizontal and vertical dividers derive their styling at render time.

Above

Below

Java composition
new Div().withChild(new Paragraph("Above")).withChild(Divider.horizontal()).withChild(new Paragraph("Below")).withChild(Divider.vertical());

Spacer

Explicit spacing between composed elements.

Before

After

Java composition
new Div().withChild(new Paragraph("Before")).withChild(Spacer.vertical().small()).withChild(new Paragraph("After"));

ListItem

List items compose inside semantic lists.

  • Compose
  • Render
Java composition
new HtmlTag("ul").withChild(ListItem.create("Compose")).withChild(ListItem.create("Render"));