about summary refs log tree commit diff stats
path: root/html/attributes.go
diff options
context:
space:
mode:
authorMarkus Wüstenberg2020-12-22 11:07:33 +0100
committerGitHub2020-12-22 11:07:33 +0100
commit6efec2175f61125c3cae694b9a4327a990484ca0 (patch)
treea1aa13a8dc28a747bb36961016b3c43f0a15cef3 /html/attributes.go
parentf22ce3fb68ca6702a683b7759410ae50a9fddabd (diff)
downloadgomponents-6efec2175f61125c3cae694b9a4327a990484ca0.tar.lz
gomponents-6efec2175f61125c3cae694b9a4327a990484ca0.tar.zst
gomponents-6efec2175f61125c3cae694b9a4327a990484ca0.zip
Add aria-* and role attributes (#59)
Fixes #50.
Diffstat (limited to 'html/attributes.go')
-rw-r--r--html/attributes.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/html/attributes.go b/html/attributes.go
index e67bc1f..fabfbf0 100644
--- a/html/attributes.go
+++ b/html/attributes.go
@@ -56,6 +56,11 @@ func Alt(v string) g.Node {
 	return g.Attr("alt", v)
 }
 
+// Aria attributes automatically have their name prefixed with "aria-".
+func Aria(name, v string) g.Node {
+	return g.Attr("aria-"+name, v)
+}
+
 func AutoComplete(v string) g.Node {
 	return g.Attr("autocomplete", v)
 }
@@ -140,6 +145,10 @@ func Rel(v string) g.Node {
 	return g.Attr("rel", v)
 }
 
+func Role(v string) g.Node {
+	return g.Attr("role", v)
+}
+
 func Rows(v string) g.Node {
 	return g.Attr("rows", v)
 }