Documentation
¶
Index ¶
- Variables
- func For(forID string, str string) *element
- func New(nodes ...node.Node) *element
- func NewLabel(forID string, nodes ...node.Node) *element
- func RawText(str string) *element
- func RawTextf(format string, args ...any) *element
- func Static(str string) *element
- func Text(str string) *element
- func Textf(format string, args ...any) *element
- type Element
Constants ¶
This section is empty.
Variables ¶
var ( TagOpen = []byte("<label") TagClose = []byte("</label>") AttrFor = []byte(" for=\"") )
Byte constants for HTML rendering.
Functions ¶
func For ¶
For Creates a label element associated with a form control by ID, with text content. The most common label pattern. Uses text.Text which HTML-escapes the output. Example: label.For("email", "Email Address") Renders: <label for="email">Email Address</label>
func New ¶
New Creates a new label element with child nodes. Example: label.New() Renders: <label></label>
func NewLabel ¶
NewLabel Creates a new label element with for attribute and child nodes. Example: label.NewLabel("email") Renders: <label for="email"></label>
func RawText ¶
func RawText(str string) *element
RawText Creates a new label element with raw text content. Uses text.RawText which is not HTML-escaped. Example: label.RawText("Email <abbr>Addr.</abbr>") Renders: <label>Email <abbr>Addr.</abbr></label>
func RawTextf ¶
RawTextf Creates a new label element with formatted raw text content. Uses text.RawTextf which is not HTML-escaped. Example: label.RawTextf("<strong>%s</strong>", field) Renders: <label><strong>Email</strong></label>
func Static ¶
func Static(str string) *element
Static Creates a new label element with static text content. Uses text.Static which is not HTML-escaped and is JIT-optimisable. Example: label.Static("Password") Renders: <label>Password</label>