about summary refs log tree commit diff stats
path: root/html/attributes.go
diff options
context:
space:
mode:
Diffstat (limited to 'html/attributes.go')
-rw-r--r--html/attributes.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/html/attributes.go b/html/attributes.go
index fabfbf0..23559f6 100644
--- a/html/attributes.go
+++ b/html/attributes.go
@@ -81,6 +81,11 @@ func Content(v string) g.Node {
 	return g.Attr("content", v)
 }
 
+// DataAttr attributes automatically have their name prefixed with "data-".
+func DataAttr(name, v string) g.Node {
+	return g.Attr("data-"+name, v)
+}
+
 func For(v string) g.Node {
 	return g.Attr("for", v)
 }