-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathButtonComponent.html
More file actions
35 lines (29 loc) · 1.25 KB
/
ButtonComponent.html
File metadata and controls
35 lines (29 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<!--
ButtonComponent template with fragment-based conditional rendering.
Each fragment corresponds to a specific ViewContext type.
Only the fragment matching the current ViewContext type will be rendered.
-->
<div view:context-root xmlns:view="https://github.com/tschuehly/spring-view-component">
<!-- Fragment for PrimaryButton context -->
<button view:context="PrimaryButton"
class="btn btn-primary"
type="button"
th:attr="data-action=${primaryButton.action}">
<span th:text="${primaryButton.label}">Primary Action</span>
</button>
<!-- Fragment for SecondaryButton context -->
<button view:context="SecondaryButton"
class="btn btn-secondary"
type="button"
th:attr="data-action=${secondaryButton.action}">
<span th:text="${secondaryButton.label}">Secondary Action</span>
</button>
<!-- Fragment for DangerButton context -->
<button view:context="DangerButton"
class="btn btn-danger"
type="button"
th:attr="data-action=${dangerButton.action}"
th:onclick="|return confirm('${dangerButton.confirmMessage}')|">
<span th:text="${dangerButton.label}">Danger Action</span>
</button>
</div>