all repos — gomponents @ 13701c4f668eba27956a8ac554a1fe272245d210

HTML components in pure Go

Add attribute helpers (#35) Also refactor tests to be table-driven, for readability.

Markus Wüstenberg
commit

13701c4f668eba27956a8ac554a1fe272245d210

parent

18e90339fcac48806a5777766aeb256be2b8c4bc

1 file changed, 105 insertions(+), 0 deletions(-)

changed files
A attr/simple.go
@@ -0,0 +1,105 @@
+package attr + +import ( + g "github.com/maragudk/gomponents" +) + +func Accept(v string) g.Node { + return g.Attr("accept", v) +} + +func AutoComplete(v string) g.Node { + return g.Attr("autocomplete", v) +} + +func Class(v string) g.Node { + return g.Attr("class", v) +} + +func Form(v string) g.Node { + return g.Attr("form", v) +} + +func Height(v string) g.Node { + return g.Attr("height", v) +} + +func Href(v string) g.Node { + return g.Attr("href", v) +} + +func ID(v string) g.Node { + return g.Attr("id", v) +} + +func Lang(v string) g.Node { + return g.Attr("lang", v) +} + +func Max(v string) g.Node { + return g.Attr("max", v) +} + +func MaxLength(v string) g.Node { + return g.Attr("maxlength", v) +} + +func Min(v string) g.Node { + return g.Attr("min", v) +} + +func MinLength(v string) g.Node { + return g.Attr("minlength", v) +} + +func Name(v string) g.Node { + return g.Attr("name", v) +} + +func Pattern(v string) g.Node { + return g.Attr("pattern", v) +} + +func Preload(v string) g.Node { + return g.Attr("preload", v) +} + +func Placeholder(v string) g.Node { + return g.Attr("placeholder", v) +} + +func Rel(v string) g.Node { + return g.Attr("rel", v) +} + +func Src(v string) g.Node { + return g.Attr("src", v) +} + +func Style(v string) g.Node { + return g.Attr("style", v) +} + +func TabIndex(v string) g.Node { + return g.Attr("tabindex", v) +} + +func Target(v string) g.Node { + return g.Attr("target", v) +} + +func Title(v string) g.Node { + return g.Attr("title", v) +} + +func Type(v string) g.Node { + return g.Attr("type", v) +} + +func Value(v string) g.Node { + return g.Attr("value", v) +} + +func Width(v string) g.Node { + return g.Attr("width", v) +}