2020-12-10 04:00:23 -08:00
|
|
|
package html
|
2020-10-28 08:59:04 -07:00
|
|
|
|
|
|
|
import (
|
|
|
|
g "github.com/maragudk/gomponents"
|
|
|
|
)
|
|
|
|
|
2020-12-10 04:00:23 -08:00
|
|
|
func Async() g.Node {
|
|
|
|
return g.Attr("async")
|
|
|
|
}
|
|
|
|
|
|
|
|
func AutoFocus() g.Node {
|
|
|
|
return g.Attr("autofocus")
|
|
|
|
}
|
|
|
|
|
|
|
|
func AutoPlay() g.Node {
|
|
|
|
return g.Attr("autoplay")
|
|
|
|
}
|
|
|
|
|
2023-05-11 02:22:01 -07:00
|
|
|
func Checked() g.Node {
|
|
|
|
return g.Attr("checked")
|
|
|
|
}
|
|
|
|
|
2020-12-10 04:00:23 -08:00
|
|
|
func Controls() g.Node {
|
|
|
|
return g.Attr("controls")
|
|
|
|
}
|
|
|
|
|
|
|
|
func Defer() g.Node {
|
|
|
|
return g.Attr("defer")
|
|
|
|
}
|
|
|
|
|
|
|
|
func Disabled() g.Node {
|
|
|
|
return g.Attr("disabled")
|
|
|
|
}
|
|
|
|
|
2021-06-18 00:39:47 -07:00
|
|
|
func Loop() g.Node {
|
|
|
|
return g.Attr("loop")
|
|
|
|
}
|
|
|
|
|
2020-12-10 04:00:23 -08:00
|
|
|
func Multiple() g.Node {
|
|
|
|
return g.Attr("multiple")
|
|
|
|
}
|
|
|
|
|
2021-06-18 00:39:47 -07:00
|
|
|
func Muted() g.Node {
|
|
|
|
return g.Attr("muted")
|
|
|
|
}
|
|
|
|
|
|
|
|
func PlaysInline() g.Node {
|
|
|
|
return g.Attr("playsinline")
|
|
|
|
}
|
|
|
|
|
2020-12-10 04:00:23 -08:00
|
|
|
func ReadOnly() g.Node {
|
|
|
|
return g.Attr("readonly")
|
|
|
|
}
|
|
|
|
|
|
|
|
func Required() g.Node {
|
|
|
|
return g.Attr("required")
|
|
|
|
}
|
|
|
|
|
|
|
|
func Selected() g.Node {
|
|
|
|
return g.Attr("selected")
|
|
|
|
}
|
|
|
|
|
2020-10-28 08:59:04 -07:00
|
|
|
func Accept(v string) g.Node {
|
|
|
|
return g.Attr("accept", v)
|
|
|
|
}
|
|
|
|
|
Simplify available elements (#55)
`a`, `form`, `img`, `input`, `label`, `option`, `progress`, `select`, and `textarea` are now just regular elements (without helper parameters), because:
- Sometimes the use case doesn't fit (`a` as anchor without href, for example)
- There's no reason these are special among the others, so streamlining them makes sense
Also added new attributes `action`, `alt`, `for`, `method` that I had somehow missed.
2020-12-10 05:20:33 -08:00
|
|
|
func Action(v string) g.Node {
|
|
|
|
return g.Attr("action", v)
|
|
|
|
}
|
|
|
|
|
|
|
|
func Alt(v string) g.Node {
|
|
|
|
return g.Attr("alt", v)
|
|
|
|
}
|
|
|
|
|
2020-12-22 02:07:33 -08:00
|
|
|
// Aria attributes automatically have their name prefixed with "aria-".
|
|
|
|
func Aria(name, v string) g.Node {
|
|
|
|
return g.Attr("aria-"+name, v)
|
|
|
|
}
|
|
|
|
|
2021-06-08 07:52:57 -07:00
|
|
|
func As(v string) g.Node {
|
|
|
|
return g.Attr("as", v)
|
|
|
|
}
|
|
|
|
|
2020-10-28 08:59:04 -07:00
|
|
|
func AutoComplete(v string) g.Node {
|
|
|
|
return g.Attr("autocomplete", v)
|
|
|
|
}
|
|
|
|
|
2020-10-29 04:03:43 -07:00
|
|
|
func Charset(v string) g.Node {
|
|
|
|
return g.Attr("charset", v)
|
|
|
|
}
|
|
|
|
|
2020-10-28 08:59:04 -07:00
|
|
|
func Class(v string) g.Node {
|
|
|
|
return g.Attr("class", v)
|
|
|
|
}
|
|
|
|
|
2020-11-16 04:03:54 -08:00
|
|
|
func Cols(v string) g.Node {
|
|
|
|
return g.Attr("cols", v)
|
|
|
|
}
|
|
|
|
|
2023-01-17 04:00:16 -08:00
|
|
|
func ColSpan(v string) g.Node {
|
|
|
|
return g.Attr("colspan", v)
|
|
|
|
}
|
|
|
|
|
2020-10-29 04:03:43 -07:00
|
|
|
func Content(v string) g.Node {
|
|
|
|
return g.Attr("content", v)
|
|
|
|
}
|
|
|
|
|
2020-12-22 02:46:49 -08:00
|
|
|
// DataAttr attributes automatically have their name prefixed with "data-".
|
|
|
|
func DataAttr(name, v string) g.Node {
|
|
|
|
return g.Attr("data-"+name, v)
|
|
|
|
}
|
|
|
|
|
Simplify available elements (#55)
`a`, `form`, `img`, `input`, `label`, `option`, `progress`, `select`, and `textarea` are now just regular elements (without helper parameters), because:
- Sometimes the use case doesn't fit (`a` as anchor without href, for example)
- There's no reason these are special among the others, so streamlining them makes sense
Also added new attributes `action`, `alt`, `for`, `method` that I had somehow missed.
2020-12-10 05:20:33 -08:00
|
|
|
func For(v string) g.Node {
|
|
|
|
return g.Attr("for", v)
|
|
|
|
}
|
|
|
|
|
2020-12-10 04:00:23 -08:00
|
|
|
func FormAttr(v string) g.Node {
|
2020-10-28 08:59:04 -07:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
|
2021-09-07 03:09:57 -07:00
|
|
|
func Loading(v string) g.Node {
|
|
|
|
return g.Attr("loading", v)
|
|
|
|
}
|
|
|
|
|
2020-10-28 08:59:04 -07:00
|
|
|
func Max(v string) g.Node {
|
|
|
|
return g.Attr("max", v)
|
|
|
|
}
|
|
|
|
|
|
|
|
func MaxLength(v string) g.Node {
|
|
|
|
return g.Attr("maxlength", v)
|
|
|
|
}
|
|
|
|
|
Simplify available elements (#55)
`a`, `form`, `img`, `input`, `label`, `option`, `progress`, `select`, and `textarea` are now just regular elements (without helper parameters), because:
- Sometimes the use case doesn't fit (`a` as anchor without href, for example)
- There's no reason these are special among the others, so streamlining them makes sense
Also added new attributes `action`, `alt`, `for`, `method` that I had somehow missed.
2020-12-10 05:20:33 -08:00
|
|
|
func Method(v string) g.Node {
|
|
|
|
return g.Attr("method", v)
|
|
|
|
}
|
|
|
|
|
2020-10-28 08:59:04 -07:00
|
|
|
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 Placeholder(v string) g.Node {
|
|
|
|
return g.Attr("placeholder", v)
|
|
|
|
}
|
|
|
|
|
2021-06-18 00:39:47 -07:00
|
|
|
func Poster(v string) g.Node {
|
|
|
|
return g.Attr("poster", v)
|
|
|
|
}
|
|
|
|
|
|
|
|
func Preload(v string) g.Node {
|
|
|
|
return g.Attr("preload", v)
|
|
|
|
}
|
|
|
|
|
2020-10-28 08:59:04 -07:00
|
|
|
func Rel(v string) g.Node {
|
|
|
|
return g.Attr("rel", v)
|
|
|
|
}
|
|
|
|
|
2020-12-22 02:07:33 -08:00
|
|
|
func Role(v string) g.Node {
|
|
|
|
return g.Attr("role", v)
|
|
|
|
}
|
|
|
|
|
2020-11-16 04:03:54 -08:00
|
|
|
func Rows(v string) g.Node {
|
|
|
|
return g.Attr("rows", v)
|
|
|
|
}
|
|
|
|
|
2023-01-17 04:00:16 -08:00
|
|
|
func RowSpan(v string) g.Node {
|
|
|
|
return g.Attr("rowspan", v)
|
|
|
|
}
|
|
|
|
|
2020-10-28 08:59:04 -07:00
|
|
|
func Src(v string) g.Node {
|
|
|
|
return g.Attr("src", v)
|
|
|
|
}
|
|
|
|
|
2021-09-07 03:09:57 -07:00
|
|
|
func SrcSet(v string) g.Node {
|
|
|
|
return g.Attr("srcset", v)
|
|
|
|
}
|
|
|
|
|
2023-01-17 04:05:47 -08:00
|
|
|
func Step(v string) g.Node {
|
|
|
|
return g.Attr("step", v)
|
|
|
|
}
|
|
|
|
|
2020-12-10 04:00:23 -08:00
|
|
|
func StyleAttr(v string) g.Node {
|
2020-10-28 08:59:04 -07:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
|
2020-12-10 04:00:23 -08:00
|
|
|
func TitleAttr(v string) g.Node {
|
2020-10-28 08:59:04 -07:00
|
|
|
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)
|
|
|
|
}
|
2022-09-29 03:46:36 -07:00
|
|
|
|
|
|
|
func EncType(v string) g.Node {
|
|
|
|
return g.Attr("enctype", v)
|
|
|
|
}
|