@@ -6,24 +6,72 @@ import (
6
6
g "github.com/maragudk/gomponents"
7
7
)
8
8
9
- // Boost for links and forms.
9
+ // Boost to add or remove progressive enhancement for links and forms.
10
10
// See https://htmx.org/attributes/hx-boost
11
11
func Boost (v string ) g.Node {
12
12
return attr ("boost" , v )
13
13
}
14
14
15
- // Get the url .
15
+ // Get from the specified URL .
16
16
// See https://htmx.org/attributes/hx-get
17
17
func Get (url string ) g.Node {
18
18
return attr ("get" , url )
19
19
}
20
20
21
- // Post to the url .
21
+ // Post to the specified URL .
22
22
// See https://htmx.org/attributes/hx-post
23
23
func Post (url string ) g.Node {
24
24
return attr ("post" , url )
25
25
}
26
26
27
+ // PushURL into the browser location bar, creating a new history entry.
28
+ // See https://htmx.org/attributes/hx-push-url
29
+ func PushURL (v string ) g.Node {
30
+ return attr ("push-url" , v )
31
+ }
32
+
33
+ // Select content to swap in from a response.
34
+ // See https://htmx.org/attributes/hx-select
35
+ func Select (v string ) g.Node {
36
+ return attr ("select" , v )
37
+ }
38
+
39
+ // SelectOOB content to swap in from a response, out of band (somewhere other than the target).
40
+ // See https://htmx.org/attributes/hx-select-oob
41
+ func SelectOOB (v string ) g.Node {
42
+ return attr ("select-oob" , v )
43
+ }
44
+
45
+ // Swap controls how content is swapped in.
46
+ // See https://htmx.org/attributes/hx-swap
47
+ func Swap (v string ) g.Node {
48
+ return attr ("swap" , v )
49
+ }
50
+
51
+ // SwapOOB marks content in a response to be out of band (should swap in somewhere other than the target).
52
+ // See https://htmx.org/attributes/hx-swap-oob
53
+ func SwapOOB (v string ) g.Node {
54
+ return attr ("swap-oob" , v )
55
+ }
56
+
57
+ // Target specifies the target element to be swapped.
58
+ // See https://htmx.org/attributes/hx-target
59
+ func Target (v string ) g.Node {
60
+ return attr ("target" , v )
61
+ }
62
+
63
+ // Trigger specifies the event that triggers the request.
64
+ // See https://htmx.org/attributes/hx-trigger
65
+ func Trigger (v string ) g.Node {
66
+ return attr ("trigger" , v )
67
+ }
68
+
69
+ // Vals adds values to the parameters to submit with the request (JSON-formatted).
70
+ // See https://htmx.org/attributes/hx-vals
71
+ func Vals (v string ) g.Node {
72
+ return attr ("vals" , v )
73
+ }
74
+
27
75
func attr (name , value string ) g.Node {
28
76
return g .Attr ("hx-" + name , value )
29
77
}
0 commit comments