<div th:switch="${user.role}"> <p th:case="'admin'">User is an administrator</p> <p th:case="#{roles.manager}">User is a manager</p> <p th:case="*">User is some other thing</p> </div> <div th:with="condition=${potentially_complex_expression}" th:remove="tag"> <h2 th:if="${condition}">Hello!</h2> <span th:unless="${condition}" class="xxx">Something else</span> </div> wrong: <div th:if="${condition}" th:replace="path/to/fragment : #fragmentId"></div>