Documentation
¶
Index ¶
- Constants
- func IfElse[T any](condition bool, result, alternative T) T
- func Render(w io.Writer, node Node) error
- type CrossoriginValue
- type DecodingValue
- type Element
- type EnctypeValue
- type InputTypeValue
- type KV
- type LoadingValue
- type MethodValue
- type Node
- func A(args ...any) Node
- func Abbr(args ...any) Node
- func Address(args ...any) Node
- func Area(attrs ...KV) Node
- func Article(args ...any) Node
- func Aside(args ...any) Node
- func Audio(args ...any) Node
- func B(args ...any) Node
- func Base(attrs ...KV) Node
- func Bdi(args ...any) Node
- func Bdo(args ...any) Node
- func Blockquote(args ...any) Node
- func Body(args ...any) Node
- func Br(attrs ...KV) Node
- func Button(args ...any) Node
- func Canvas(args ...any) Node
- func Caption(args ...any) Node
- func Cite(args ...any) Node
- func Code(args ...any) Node
- func Col(attrs ...KV) Node
- func Colgroup(args ...any) Node
- func Data(args ...any) Node
- func Datalist(args ...any) Node
- func Dd(args ...any) Node
- func Del(args ...any) Node
- func Details(args ...any) Node
- func Dfn(args ...any) Node
- func Dialog(args ...any) Node
- func Div(args ...any) Node
- func Dl(args ...any) Node
- func DoctypeHTML() Node
- func Dt(args ...any) Node
- func Em(args ...any) Node
- func Embed(attrs ...KV) Node
- func Empty(args ...any) Node
- func Fencedframe(args ...any) Node
- func Fieldset(args ...any) Node
- func Figcaption(args ...any) Node
- func Figure(args ...any) Node
- func Footer(args ...any) Node
- func Form(args ...any) Node
- func H1(args ...any) Node
- func H2(args ...any) Node
- func H3(args ...any) Node
- func H4(args ...any) Node
- func H5(args ...any) Node
- func H6(args ...any) Node
- func Head(args ...any) Node
- func Header(args ...any) Node
- func Hgroup(args ...any) Node
- func Hr(attrs ...KV) Node
- func Html(args ...any) Node
- func I(args ...any) Node
- func If(condition bool, result Node) Node
- func Iframe(args ...any) Node
- func Img(attrs ...KV) Node
- func Input(attrs ...KV) Node
- func Ins(args ...any) Node
- func Kbd(args ...any) Node
- func Label(args ...any) Node
- func Legend(args ...any) Node
- func Li(args ...any) Node
- func Link(attrs ...KV) Node
- func Main(args ...any) Node
- func Map(args ...any) Node
- func MapSlice[T any](input []T, f func(T) Node) Node
- func Mark(args ...any) Node
- func Math(args ...any) Node
- func Menu(args ...any) Node
- func Meta(attrs ...KV) Node
- func Meter(args ...any) Node
- func Nav(args ...any) Node
- func Noscript(args ...any) Node
- func Object(args ...any) Node
- func Ol(args ...any) Node
- func Optgroup(args ...any) Node
- func Option(args ...any) Node
- func Output(args ...any) Node
- func P(args ...any) Node
- func Picture(args ...any) Node
- func Pre(args ...any) Node
- func Progress(args ...any) Node
- func Q(args ...any) Node
- func Repeat(n int, f func() Node) Node
- func Rp(args ...any) Node
- func Rt(args ...any) Node
- func Ruby(args ...any) Node
- func S(args ...any) Node
- func Samp(args ...any) Node
- func Script(args ...any) Node
- func Search(args ...any) Node
- func Section(args ...any) Node
- func Select(args ...any) Node
- func Selectedcontent(args ...any) Node
- func Slot(args ...any) Node
- func Small(args ...any) Node
- func Source(attrs ...KV) Node
- func Span(args ...any) Node
- func Strong(args ...any) Node
- func Style(args ...any) Node
- func Sub(args ...any) Node
- func Summary(args ...any) Node
- func Sup(args ...any) Node
- func Svg(args ...any) Node
- func Table(args ...any) Node
- func Tbody(args ...any) Node
- func Td(args ...any) Node
- func Template(args ...any) Node
- func Textarea(args ...any) Node
- func Tfoot(args ...any) Node
- func Th(args ...any) Node
- func Thead(args ...any) Node
- func Time(args ...any) Node
- func Title(args ...any) Node
- func Tr(args ...any) Node
- func Track(attrs ...KV) Node
- func U(args ...any) Node
- func Ul(args ...any) Node
- func Var(args ...any) Node
- func Video(args ...any) Node
- func Wbr(attrs ...KV) Node
- type RawHTML
- type ReferrerpolicyValue
- type RelValue
- type ScopeValue
- type ScriptTypeValue
- type TargetValue
Constants ¶
const ( // AttrClass is a space-separated list of CSS class names for the element. AttrClass = "class" // AttrID is the unique identifier for the element (must be unique within the document). AttrID = "id" // AttrStyle contains inline CSS styling declarations for the element. AttrStyle = "style" // AttrTitle provides advisory information about the element, often displayed as a tooltip. AttrTitle = "title" // AttrLang defines the primary language for the element's contents. AttrLang = "lang" // AttrDir indicates the directionality of the element's text content (ltr, rtl, or auto). AttrDir = "dir" // AttrHidden indicates that the element is not yet relevant or is no longer relevant. AttrHidden = "hidden" // AttrTabindex specifies whether the element is focusable and its position in tab order. AttrTabindex = "tabindex" // AttrType specifies the type of some element (e.g., script, input, button, object, source). AttrType = "type" // AttrHref specifies the URL of the linked resource. AttrHref = "href" // AttrRel defines the relationship between the current document and the linked resource. AttrRel = "rel" // AttrTarget specifies where to display the linked resource (_blank, _self, _parent, _top). AttrTarget = "target" // AttrHreflang indicates the language of the linked resource. AttrHreflang = "hreflang" // AttrDownload indicates that the link should be downloaded rather than navigated to. AttrDownload = "download" // AttrSrc specifies the URL of the media resource. AttrSrc = "src" // AttrSrcset defines multiple image sources for responsive images. AttrSrcset = "srcset" // AttrSizes specifies image widths for selecting the appropriate source. AttrSizes = "sizes" // AttrAlt provides alternative text for images. AttrAlt = "alt" // AttrWidth specifies the display width in pixels. AttrWidth = "width" // AttrHeight specifies the display height in pixels. AttrHeight = "height" // AttrLoading controls whether the browser should lazy-load the image. AttrLoading = "loading" // AttrDecoding provides a hint to the browser for decoding the image. AttrDecoding = "decoding" // AttrAction specifies the URL for form submission. AttrAction = "action" // AttrMethod specifies the HTTP method (get, post, dialog). AttrMethod = "method" // AttrEnctype specifies the encoding type for form data. AttrEnctype = "enctype" // AttrNovalidate disables form validation on submission. AttrNovalidate = "novalidate" // AttrName specifies the name of the input element, submitted with form data. AttrName = "name" // AttrValue specifies the initial value of the input element. AttrValue = "value" // AttrPlaceholder provides a hint to the user about what to enter. AttrPlaceholder = "placeholder" // AttrRequired indicates the user must fill in a value before submitting. AttrRequired = "required" // AttrDisabled indicates the element is disabled and cannot be interacted with. AttrDisabled = "disabled" // AttrReadonly indicates the element is not editable but can be focused. AttrReadonly = "readonly" // AttrChecked indicates whether a checkbox or radio button is selected. AttrChecked = "checked" // AttrSelected indicates whether an option in a select element is selected. AttrSelected = "selected" // AttrMultiple allows multiple values to be selected. AttrMultiple = "multiple" // AttrAutofocus indicates the element should be focused when the page loads. AttrAutofocus = "autofocus" // AttrAutocomplete hints to browsers whether to autofill the field. AttrAutocomplete = "autocomplete" // AttrPattern specifies a regular expression for validating input. AttrPattern = "pattern" // AttrMin specifies the minimum value allowed. AttrMin = "min" // AttrMax specifies the maximum value allowed. AttrMax = "max" // AttrStep specifies the increment/decrement step for numeric inputs. AttrStep = "step" // AttrMinlength specifies the minimum number of characters required. AttrMinlength = "minlength" // AttrMaxlength specifies the maximum number of characters allowed. AttrMaxlength = "maxlength" // AttrSize specifies the width of the input element in characters. AttrSize = "size" // AttrAsync executes the script asynchronously (non-blocking). AttrAsync = "async" // AttrDefer defers execution until HTML parsing completes. AttrDefer = "defer" // AttrNonce is a cryptographic nonce for Content Security Policy. AttrNonce = "nonce" // AttrCrossorigin specifies how to handle CORS requests. AttrCrossorigin = "crossorigin" // AttrIntegrity provides a hash to verify script integrity. AttrIntegrity = "integrity" // AttrNomodule prevents execution in ES module-supporting browsers. AttrNomodule = "nomodule" // AttrReferrerpolicy specifies the referrer policy for fetch. AttrReferrerpolicy = "referrerpolicy" // AttrCharset declares the character encoding for the document. AttrCharset = "charset" // AttrContent contains the value for the metadata. AttrContent = "content" // AttrHttpEquiv defines a pragma directive equivalent to an HTTP header. AttrHttpEquiv = "http-equiv" // AttrColspan specifies the number of columns a cell should span. AttrColspan = "colspan" // AttrRowspan specifies the number of rows a cell should span. AttrRowspan = "rowspan" // AttrHeaders associates header cells with data cells for accessibility. AttrHeaders = "headers" // AttrScope defines whether a header cell is for a row, column, or group. AttrScope = "scope" // AttrSpan specifies the number of columns in a colgroup. AttrSpan = "span" // AttrSrcdoc specifies the HTML content to embed inline. AttrSrcdoc = "srcdoc" // AttrSandbox applies extra restrictions on the iframe's content. AttrSandbox = "sandbox" // AttrAllow specifies a feature policy for the iframe. AttrAllow = "allow" // AttrCsp enforces Content Security Policy on the embedded content. AttrCsp = "csp" )
Variables ¶
This section is empty.
Functions ¶
func IfElse ¶
IfElse returns the appropriate value based on a boolean condition.
This generic function is useful for inline conditional expressions in builder-style code where you need to choose between two values without breaking the chain of method calls.
Example:
div := Div(KV{"class": IfElse(isActive, "active", "inactive")})
Body(
IfElse(isAdmin,
Div("Admin content"),
P("Regular user content"),
),
)
Types ¶
type CrossoriginValue ¶
type CrossoriginValue = string
CrossoriginValue represents valid values for the crossorigin attribute.
const ( // CrossoriginAnonymous sends CORS request without credentials. CrossoriginAnonymous CrossoriginValue = "anonymous" // CrossoriginUseCredentials sends CORS request with credentials. CrossoriginUseCredentials CrossoriginValue = "use-credentials" )
type DecodingValue ¶
type DecodingValue = string
DecodingValue represents valid values for the decoding attribute.
const ( // DecodingSync decodes synchronously, blocking other content. DecodingSync DecodingValue = "sync" // DecodingAsync decodes asynchronously to prevent blocking. DecodingAsync DecodingValue = "async" // DecodingAuto lets the browser decide (default). DecodingAuto DecodingValue = "auto" )
type Element ¶
type Element struct {
Tag string // HTML tag name
IsVoid bool // Whether the tag is self-closing (e.g., <br>, <img>)
Attrs []attribute // HTML attributes as key-value pairs
Children []Node // Child nodes
}
Element represents an HTML element with its attributes and children.
type EnctypeValue ¶
type EnctypeValue = string
EnctypeValue represents valid encoding types for forms.
const ( // EnctypeURLencoded encodes as key-value pairs (default). EnctypeURLencoded EnctypeValue = "application/x-www-form-urlencoded" // EnctypeMultipart encodes as multipart MIME (for file uploads). EnctypeMultipart EnctypeValue = "multipart/form-data" // EnctypePlain sends as plain text without encoding. EnctypePlain EnctypeValue = "text/plain" )
type InputTypeValue ¶
type InputTypeValue = string
InputTypeValue represents valid values for the type attribute of input elements.
const ( // InputTypeText is a single-line text field (default). InputTypeText InputTypeValue = "text" // InputTypePassword obscures entered text. InputTypePassword InputTypeValue = "password" // InputTypeEmail is for email addresses with validation. InputTypeEmail InputTypeValue = "email" // InputTypeTel is for telephone numbers. InputTypeTel InputTypeValue = "tel" // InputTypeUrl is for URLs with validation. InputTypeUrl InputTypeValue = "url" // InputTypeNumber is for numeric values with validation. InputTypeNumber InputTypeValue = "number" // InputTypeSearch is for search queries. InputTypeSearch InputTypeValue = "search" // InputTypeDate is for dates (year, month, day). InputTypeDate InputTypeValue = "date" // InputTypeDatetimeLocal is for date and time without timezone. InputTypeDatetimeLocal InputTypeValue = "datetime-local" // InputTypeMonth is for month and year. InputTypeMonth InputTypeValue = "month" // InputTypeWeek is for week and year. InputTypeWeek InputTypeValue = "week" // InputTypeTime is for time values (hours and minutes). InputTypeTime InputTypeValue = "time" // InputTypeCheckbox allows multiple selections. InputTypeCheckbox InputTypeValue = "checkbox" // InputTypeRadio allows single selection from a group. InputTypeRadio InputTypeValue = "radio" // InputTypeFile allows selecting one or more files. InputTypeFile InputTypeValue = "file" // InputTypeSubmit submits the form. InputTypeSubmit InputTypeValue = "submit" // InputTypeReset resets the form to defaults. InputTypeReset InputTypeValue = "reset" // InputTypeButton is a button with no default behavior. InputTypeButton InputTypeValue = "button" // InputTypeHidden is an invisible input holding data. InputTypeHidden InputTypeValue = "hidden" // InputTypeImage is a graphical submit button. InputTypeImage InputTypeValue = "image" // InputTypeColor is for selecting colors. InputTypeColor InputTypeValue = "color" // InputTypeRange is for numeric values using a slider. InputTypeRange InputTypeValue = "range" )
type KV ¶
KV represents a key-value map for HTML attributes.
The value type must be either string or bool:
- string: Attribute will have the format key="value" (HTML-escaped)
- bool: If true, attribute appears as key (valueless). If false, attribute is omitted.
- any other type triggers an error during rendering.
Example:
KV{"class": "container", "hidden": true, "disabled": false}
// Renders: class="container" hidden
type LoadingValue ¶
type LoadingValue = string
LoadingValue represents valid values for the loading attribute.
const ( // LoadingEager loads the resource immediately (default). LoadingEager LoadingValue = "eager" // LoadingLazy defers loading until the resource is near the viewport. LoadingLazy LoadingValue = "lazy" )
type MethodValue ¶
type MethodValue = string
MethodValue represents valid HTTP methods for forms.
const ( // MethodGet appends form data to the URL (default). MethodGet MethodValue = "get" // MethodPost sends form data in the request body. MethodPost MethodValue = "post" // MethodDialog closes the dialog and returns values. MethodDialog MethodValue = "dialog" )
type Node ¶
Node represents any renderable HTML element or text content.
The Node interface is the core abstraction that allows both HTML elements and text content to be treated uniformly when building and rendering HTML trees. All elements created by the factory functions (Div(), P(), Svg(), etc.) implement this interface.
Example:
var node Node = Div("Hello")
err := node.Render(os.Stdout)
func A ¶
A creates hyperlinks to other web pages, files, locations within the same page, or anything else a URL can address.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/a
func Abbr ¶
Abbr represents an abbreviation.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/abbr
func Address ¶
Address indicates contact information for a person or organization.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/address
func Area ¶
Area defines an area inside an image map that has predefined clickable areas. An image map allows geometric areas on an image to be associated with hyperlink.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/area
func Article ¶
Article creates an article element.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/article
func Aside ¶
Aside creates an aside element.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/aside
func Audio ¶
Audio is used to embed sound content in documents. It may contain one or more audio sources, represented using the src attribute or the source element: the browser will choose the most suitable one. It can also be the destination for streamed media, using a MediaStream.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/audio
func B ¶
B draws attention to text without conveying importance.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/b
func Base ¶
Base specifies the base URL and default browsing context for relative URLs.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/base
func Bdi ¶
Bdi isolates text for bidirectional text formatting.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/bdi
func Bdo ¶
Bdo overrides the current text direction.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/bdo
func Blockquote ¶
Blockquote represents a section quoted from another source.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/blockquote
func Body ¶
Body represents the content of an HTML document.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/body
func Br ¶
Br produces a line break in text (carriage-return). It is useful for writing a poem or an address, where the division of lines is significant.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/br
func Button ¶
Button is an interactive element activated by a user with a mouse, keyboard, finger, voice command, or other assistive technology. Once activated, it performs an action, such as submitting a form or opening a dialog.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/button
func Canvas ¶
Canvas is a container element to use with either the canvas scripting API or the WebGL API to draw graphics and animations.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/canvas
func Caption ¶
Caption specifies the caption (or title) of a table.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/caption
func Cite ¶
Cite marks the title of a creative work.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/cite
func Code ¶
Code displays its contents styled as computer code.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/code
func Col ¶
Col defines one or more columns in a column group represented by its implicit or explicit parent <colgroup> element. The <col> element is only valid as a child of a <colgroup> element that has no span attribute defined.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/col
func Colgroup ¶
Colgroup defines a group of columns within a table.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/colgroup
func Data ¶
Data links content with a machine-readable translation.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/data
func Datalist ¶
Datalist contains a set of <option> elements that represent the permissible or recommended options available to choose from within other controls.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/datalist
func Dd ¶
Dd provides the description, definition, or value for the preceding term.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/dd
func Del ¶
Del represents a range of text that has been deleted from a document.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/del
func Details ¶
Details creates a disclosure widget in which information is visible only when the widget is toggled into an "open" state. A summary or label must be provided using the <summary> element.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/details
func Dfn ¶
Dfn indicates the defining instance of a term.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/dfn
func Dialog ¶
Dialog represents a dialog box or other interactive component, such as a dismissible alert, inspector, or subwindow.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/dialog
func Div ¶
Div is the generic container for flow content.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/div
func Dl ¶
Dl represents a description list.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/dl
func Dt ¶
Dt specifies a term in a description or definition list.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/dt
func Em ¶
Em marks text with emphasis.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/em
func Embed ¶
Embed embeds external content at the specified point in the document.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/embed
func Fencedframe ¶
Fencedframe represents a nested browsing context, like <iframe> but with more native privacy features built in.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/fencedframe
func Fieldset ¶
Fieldset is used to group several controls as well as labels (<label>) within a web form.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/fieldset
func Figcaption ¶
Figcaption represents a caption or legend for the contents of its parent figure element.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/figcaption
func Figure ¶
Figure represents self-contained content with an optional caption.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/figure
func Footer ¶
Footer creates a footer element.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/footer
func Form ¶
Form represents a document section containing interactive controls for submitting information.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/form
func H1 ¶
H1 creates a level 1 heading element.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/h1
func H2 ¶
H2 creates a level 2 heading element.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/h2
func H3 ¶
H3 creates a level 3 heading element.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/h3
func H4 ¶
H4 creates a level 4 heading element.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/h4
func H5 ¶
H5 creates a level 5 heading element.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/h5
func H6 ¶
H6 creates a level 6 heading element.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/h6
func Head ¶
Head contains machine-readable information about the document.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/head
func Header ¶
Header creates a header element.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/header
func Hgroup ¶
Hgroup groups a set of h1–h6 elements when they represent a multi-level heading.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/hgroup
func Hr ¶
Hr represents a thematic break between paragraph-level elements.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/hr
func Html ¶
Html creates the root element of an HTML document.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/html
func I ¶
I represents text in an alternate voice or mood.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/i
func If ¶
Conditionally returns a Node based on a boolean condition.
This function returns an empty Node (not nil) when the condition is false, which prevents nil pointer issues when building DOM trees.
Example:
Body( If(showHeader, Header(...)), Main(...), )
func Iframe ¶
Iframe represents a nested browsing context, embedding another HTML page into the current one.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/iframe
func Img ¶
Img embeds an image into the document.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/img
func Input ¶
Input is used to create interactive controls for web-based forms to accept data from the user; a wide variety of types of input data and control widgets are available, depending on the device and user agent. The <input> element is one of the most powerful and complex in all of HTML due to the sheer number of combinations of input types and attributes.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input
func Ins ¶
Ins represents a range of text that has been added to a document.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/ins
func Kbd ¶
Kbd represents text that the user should enter.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/kbd
func Label ¶
Label represents a caption for an item in a user interface.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/label
func Legend ¶
Legend represents a caption for the content of its parent <fieldset>.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/legend
func Li ¶
Li represents a list item.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/li
func Link ¶
Link specifies relationships between the current document and an external resource.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/link
func Main ¶
Main creates a main content element.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/main
func Map ¶
Map is used with <area> elements to define an image map (a clickable link area).
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/map
func MapSlice ¶
MapSlice transforms a slice of items into Nodes by applying a function to each element.
Each element in the input slice is transformed using the provided function, and all resulting Nodes are aggregated into a single container Node.
Example:
items := []string{"Apple", "Banana", "Cherry"}
Ul(
MapSlice(items, func(item string) Node {
return Li(item)
}),
)
func Mark ¶
Mark highlights text for reference.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/mark
func Math ¶
Math is the top-level element in MathML. Every valid MathML instance must be wrapped in it. In addition, you must not nest a second <math> element in another, but you can have an arbitrary number of other child elements in it.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/math
func Menu ¶
Menu represents a set of commands or options.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/menu
func Meta ¶
Meta represents metadata that cannot be represented by other HTML meta-related elements.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/meta
func Meter ¶
Meter represents either a scalar value within a known range or a fractional value.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/meter
func Nav ¶
Nav creates a navigation element.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/nav
func Noscript ¶
Noscript defines a section of HTML to be inserted if a script type on the page is unsupported or if scripting is currently turned off in the browser.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/noscript
func Object ¶
Object represents an external resource, which can be treated as an image, a nested browsing context, or a resource to be handled by a plugin.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/object
func Ol ¶
Ol represents an ordered list.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/ol
func Optgroup ¶
Optgroup creates a grouping of options within a <select> element.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/optgroup
func Option ¶
Option is used to define an item contained in a <select>, an <optgroup>, or a <datalist> element. As such, <option> can represent menu items in popups and other lists of items in an HTML document.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/option
func Output ¶
Output is a container element into which a site or app can inject the results of a calculation or the outcome of a user action.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/output
func P ¶
P creates a paragraph element.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/p
func Picture ¶
Picture defines multiple sources for an img element to offer alternative versions of an image for different display/device scenarios.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/picture
func Pre ¶
Pre represents preformatted text.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/pre
func Progress ¶
Progress displays an indicator showing the completion progress of a task, typically displayed as a progress bar.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/progress
func Q ¶
Q indicates a short inline quotation.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/q
func Repeat ¶
Repeat generates multiple Nodes by calling a function n times.
The provided function is called exactly n times, and each resulting Node is aggregated into a single container Node. Using a function ensures each Node instance is unique (important for elements with mutable state).
Example:
Ul(
Repeat(5, func() Node {
return Li("List item")
}),
)
func Rp ¶
Rp provides parentheses for browsers that don't support ruby text.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/rp
func Rt ¶
Rt specifies the ruby text for ruby annotations.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/rt
func Ruby ¶
Ruby represents ruby annotations for East Asian typography.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/ruby
func S ¶
S renders text with a strikethrough.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/s
func Samp ¶
Samp represents sample output from a computer program.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/samp
func Script ¶
Script is used to embed executable code or data; this is typically used to embed or refer to JavaScript code. The <script> element can also be used with other languages, such as WebGL's GLSL shader programming language and JSON.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/script
func Search ¶
Search represents a search or filtering interface.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/search
func Section ¶
Section creates a section element.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/section
func Select ¶
Select represents a control that provides a menu of options.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/select
func Selectedcontent ¶
Selectedcontent displays the content of the currently selected <option> inside a closed <select> element.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/selectedcontent
func Slot ¶
Slot acts as a placeholder inside a web component that you can fill with your own markup, which lets you create separate DOM trees and present them together.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/slot
func Small ¶
Small represents side-comments and small print.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/small
func Source ¶
Source specifies multiple media resources for the picture, the audio element, or the video element. It is a void element, meaning that it has no content and does not have a closing tag. It is commonly used to offer the same media content in multiple file formats in order to provide compatibility with a broad range of browsers given their differing support for image file formats and media file formats.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/source
func Span ¶
Span is the generic inline container for phrasing content.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/span
func Strong ¶
Strong indicates strong importance.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/strong
func Style ¶
Style contains style information for a document or part of a document.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/style
func Sub ¶
Sub specifies inline text displayed as subscript.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/sub
func Summary ¶
Summary specifies a summary, caption, or legend for a details element's disclosure box. Clicking the <summary> element toggles the state of the parent <details> element open and closed.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/summary
func Sup ¶
Sup specifies inline text displayed as superscript.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/sup
func Svg ¶
Svg is a container defining a new coordinate system and viewport. It is used as the outermost element of SVG documents, but it can also be used to embed an SVG fragment inside an SVG or HTML document.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/svg
func Table ¶
Table represents tabular data—that is, information presented in a two-dimensional table comprised of rows and columns of cells containing data.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/table
func Tbody ¶
Tbody groups the body content in a table with information about the table's columns. This is usually in the form of column headers (<th> elements).
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/tbody
func Td ¶
Td is a child of the <tr> element, it defines a cell of a table that contains data.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/td
func Template ¶
Template holds HTML that is not to be rendered immediately when a page is loaded but may be instantiated subsequently during runtime using JavaScript.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/template
func Textarea ¶
Textarea represents a multi-line plain-text editing control, useful when you want to allow users to enter a sizeable amount of free-form text, for example, a comment on a review or feedback form.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/textarea
func Tfoot ¶
Tfoot groups the footer content in a table with information about the table's columns. This is usually a summary of the columns, e.g., a sum of the given numbers in a column.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/tfoot
func Th ¶
Th is a child of the <tr> element, it defines a cell as the header of a group of table cells. The nature of this group can be explicitly defined by the scope and headers attributes.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/th
func Thead ¶
Thead groups the header content in a table with information about the table's columns. This is usually in the form of column headers (<th> elements).
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/thead
func Time ¶
Time represents a specific period in time.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/time
func Title ¶
Title defines the document's title that is shown in a browser's title bar or a page's tab.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/title
func Tr ¶
Tr defines a row of cells in a table. The row's cells can then be established using a mix of <td> (data cell) and <th> (header cell) elements.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/tr
func Track ¶
Track is used as a child of the media elements, audio and video. It lets you specify timed text tracks (or time-based data), for example to automatically handle subtitles. The tracks are formatted in WebVTT format (.vtt files)—Web Video Text Tracks.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/track
func U ¶
U represents text with an unarticulated annotation.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/u
func Ul ¶
Ul represents an unordered list.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/ul
func Var ¶
Var represents a variable in a mathematical expression or programming context.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/var
func Video ¶
Video embeds a media player which supports video playback into the document. You can also use <video> for audio content, but the audio element may provide a more appropriate user experience.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/video
func Wbr ¶
Wbr represents a word break opportunity.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/wbr
type RawHTML ¶
type RawHTML string
RawHTML represents a text node that renders its content exactly as provided, without any HTML escaping.
type ReferrerpolicyValue ¶
type ReferrerpolicyValue = string
ReferrerpolicyValue represents valid values for the referrerpolicy attribute.
const ( // ReferrerpolicyNoReferrer never sends the Referer header. ReferrerpolicyNoReferrer ReferrerpolicyValue = "no-referrer" // ReferrerpolicyNoReferrerWhenDowngrade omits Referer when going to less secure protocol. ReferrerpolicyNoReferrerWhenDowngrade ReferrerpolicyValue = "no-referrer-when-downgrade" // ReferrerpolicyOrigin sends only the origin in Referer. ReferrerpolicyOrigin ReferrerpolicyValue = "origin" // ReferrerpolicyOriginWhenCrossOrigin sends full URL for same-origin, origin for cross-origin. ReferrerpolicyOriginWhenCrossOrigin ReferrerpolicyValue = "origin-when-cross-origin" // ReferrerpolicyUnsafeURL sends full URL in Referer (may leak data). ReferrerpolicyUnsafeURL ReferrerpolicyValue = "unsafe-url" // ReferrerpolicyStrictOrigin sends only origin, omits for less secure destinations. ReferrerpolicyStrictOrigin ReferrerpolicyValue = "strict-origin" // ReferrerpolicyStrictOriginWhenCrossOrigin is strict-origin for cross-origin. ReferrerpolicyStrictOriginWhenCrossOrigin ReferrerpolicyValue = "strict-origin-when-cross-origin" )
type RelValue ¶
type RelValue = string
RelValue represents valid values for the rel attribute.
const ( // RelStylesheet indicates the linked resource is a stylesheet. RelStylesheet RelValue = "stylesheet" // RelIcon indicates the linked resource is an icon or favicon. RelIcon RelValue = "icon" // RelShortcutIcon is a legacy value for favicons. RelShortcutIcon RelValue = "shortcut icon" // RelPreconnect advises the browser to preemptively initiate a connection. RelPreconnect RelValue = "preconnect" // RelPrefetch advises the browser to prefetch the target resource. RelPrefetch RelValue = "prefetch" // RelPrerender advises the browser to prerender the linked page. RelPrerender RelValue = "prerender" // RelDnsPrefetch advises the browser to perform DNS resolution. RelDnsPrefetch RelValue = "dns-prefetch" // RelPreload indicates the resource should be preemptively fetched. RelPreload RelValue = "preload" // RelModulepreload indicates the module script should be fetched and cached. RelModulepreload RelValue = "modulepreload" // RelAlternate indicates an alternate representation of the document. RelAlternate RelValue = "alternate" // RelAuthor provides a link to the author. RelAuthor RelValue = "author" // RelBookmark provides a permalink for the nearest section. RelBookmark RelValue = "bookmark" // RelCanonical identifies the preferred URL for the document. RelCanonical RelValue = "canonical" // RelHelp provides a link to context-sensitive help. RelHelp RelValue = "help" // RelLicense indicates the linked content contains licensing info. RelLicense RelValue = "license" // RelNext indicates the next document in a series. RelNext RelValue = "next" // RelNoFollow indicates the link should not be followed by search engines. RelNoFollow RelValue = "nofollow" // RelNoOpener prevents the linked page from accessing window.opener. RelNoOpener RelValue = "noopener" // RelNoReferrer prevents sending the Referer header. RelNoReferrer RelValue = "noreferrer" // RelPrev indicates the previous document in a series. RelPrev RelValue = "prev" // RelSearch provides a link to a search resource. RelSearch RelValue = "search" // RelTag gives a tag (keyword) for the document. RelTag RelValue = "tag" )
type ScopeValue ¶
type ScopeValue = string
ScopeValue represents valid values for the scope attribute of table headers.
const ( // ScopeRow associates the header with a single row. ScopeRow ScopeValue = "row" // ScopeCol associates the header with a single column. ScopeCol ScopeValue = "col" // ScopeRowgroup associates the header with a group of rows. ScopeRowgroup ScopeValue = "rowgroup" // ScopeColgroup associates the header with a group of columns. ScopeColgroup ScopeValue = "colgroup" )
type ScriptTypeValue ¶
type ScriptTypeValue = string
ScriptTypeValue represents valid values for the type attribute of script elements.
const ( // ScriptTypeJS is a classic JavaScript script (default). ScriptTypeJS ScriptTypeValue = "text/javascript" // ScriptTypeModule is an ES module. ScriptTypeModule ScriptTypeValue = "module" // ScriptTypeImportmap contains an import map. ScriptTypeImportmap ScriptTypeValue = "importmap" // ScriptTypeJSON contains JSON data. ScriptTypeJSON ScriptTypeValue = "application/json" // ScriptTypeSpeculation contains speculation rules. ScriptTypeSpeculation ScriptTypeValue = "speculationrules" )
type TargetValue ¶
type TargetValue = string
TargetValue represents valid values for the target attribute.
const ( // TargetBlank opens the linked document in a new window or tab. TargetBlank TargetValue = "_blank" // TargetSelf opens the linked document in the same frame (default). TargetSelf TargetValue = "_self" // TargetParent opens the linked document in the parent frame. TargetParent TargetValue = "_parent" // TargetTop opens the linked document in the full body of the window. TargetTop TargetValue = "_top" )