Thymeleaf Cheat Sheet

This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production.

A single-page, colour-coded summary of the Thymeleaf essentials, written against Thymeleaf 3.1.5, Spring Boot 4.1.1 (Spring Framework 7.0.9), Layout Dialect 4.0.1, htmx 2.0 and htmx-spring-boot 5.2.0 (versions verified 2026-10-07) — dependencies, template locations, template modes and the spring.thymeleaf.* properties, the five expression types and the basic objects, literals, operators and preprocessing, one line per utility object, the th:* attributes by purpose with their precedence order, iteration status and truthiness, fragments, th:remove values and the Layout Dialect, comments, blocks and inlining, Spring forms and #fields, internationalization, conversion and links, Spring Security, fragment rendering and htmx, reactive rendering, testing, the dialect and processor types, a template-security strip, and a strip of what changed since older tutorials — handy for quick memorization or as a downloadable PDF desk reference.

Download the Thymeleaf Cheat Sheet (PDF)

For the full explanation, every option, and additional examples, see the dedicated pages:

Start here — Thymeleaf.

Fragments and layouts — Fragments, Layouts & the Layout Dialect, and Reusable UI Components.

Assets and other outputs — Styling & Front-end Assets and Emails & Text Templates.