godom

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2023 License: MIT Imports: 8 Imported by: 0

README

GoDOM

GoDOM is a Go library that allows for the creation and rendering of HTML elements in a type-safe and idiomatic manner. It draws inspiration from the gomponents library, providing an alternative approach for constructing HTML in Go.

Features

  1. Type-Safe Elements and Attributes: GoDOM offers a strong typing system to prevent runtime errors due to incorrect usage of elements or attributes.
  2. Easily Extensible: Use custom elements and attributes, or extend the existing ones.
  3. Conditional Rendering: GoDOM supports conditional attributes and elements, which allows elements or attributes to be included or excluded based on certain conditions.
  4. Delayed Rendering: Elements and attributes can be constructed immediately before rendering, allowing for dynamic changes between the time of construction and the rendering phase.
  5. html/template integration: GoDOM can be used together with

Differences from Gomponents

While both GoDOM and gomponents provide tools for constructing HTML in Go, there are notable differences:

  • Design Philosophy: While gomponents focuses on creating a pure-functional way of building HTML, GoDOM provides a more direct way of working with elements and attributes.
  • Additional Features: GoDOM offers features like delayed and conditional rendering out of the box.

When to use which?

If you're looking for a purely functional approach, gomponents might be more suitable. If you want a direct way of manipulating and rendering HTML with additional utilities or want to implement a reusable set of advanced components, GoDOM is the way to go.

Basic Usage

Here's a basic example of using GoDOM:

Imagine you're building a blog post page. The blog post might have an optional author bio, and if the blog post is featured, it might have special stylings.

package main

import (
	"bytes"
	"fmt"
	. "github.com/tbe/godom"
	"github.com/tbe/godom/helpers"
	"github.com/tbe/godom/util"
)

func main() {
	isFeatured := true // this can be dynamically set based on data
	showAuthorBio := true

	// Conditional class for featured post
	featuredClass := util.IfAttr(isFeatured, Class("featured"))

	// Conditional author bio
	authorBio := util.IfElem(showAuthorBio, Div(Class("author-bio"))(
		P()(Content("This is the author's bio. It provides information about the author.")),
	))

	// Delayed attribute example: A function that decides the attribute based on some condition
	dynamicAttribute := util.DelayedAttribute(func(attrs map[string]string, _ *[]string, _ *[]types.Attribute) {
		if isFeatured {
			attrs["data-highlight"] = "true"
		}
	})

	// Delayed element: Maybe we decide to render a special note for featured articles
	featuredNote := util.DelayedElement(func() types.Element {
		if isFeatured {
			return P(Class("featured-note"))(Content("This is a featured article!"))
		}
		return util.IfElem(false, nil) // returns an empty group if not featured
	})

	// Construct the full document
	doc := Group(
		Doctype(),
		HTML()(
			Header()(
				Meta(Charset("utf-8")),
				Title()(Content("Blog Post Title")),
			),
			Body()(
				Div(Class("blog-post"), featuredClass, dynamicAttribute)(
					H1()(Content("Blog Post Title")),
					P()(Content("This is the introduction of the blog post.")),
					featuredNote,
					authorBio,
				),
			),
		),
	)

	var buf bytes.Buffer
	doc.Render(&buf)

	fmt.Println(buf.String())
}

Integration with GoDOM's template package

The template package within GoDOM provides a powerful bridge between GoDOM elements and traditional HTML templating. It offers a seamless way to combine static template constructs with dynamic GoDOM elements, enabling efficient and optimized rendering.

Example

Consider a scenario where you have a GoDOM element for an article, but you want the article's content and attributes to be populated dynamically:

package main

import (
	"bytes"
	. "github.com/tbe/godom"
	"github.com/tbe/godom/helpers"
	"github.com/tbe/godom/template"
)

func main() {
	// Create a new template
	tmpl := template.New("article")

	// Define the structure using GoDOM and the template placeholders
	articleElement := Div(Class("article"), tmpl.Attribute("data-id"))(
		H2()(tmpl.Placeholder("title")),
		P()(tmpl.Placeholder("content")),
	)

	// Parse the GoDOM element into the template
	template.Must(tmpl.Parse(articleElement))

	// Render the template with dynamic content
	var buf bytes.Buffer
	tmpl.Execute(&buf, &template.Context{
		Placeholders: map[string]types.Element{
			"title":   helpers.NewStringElement("Dynamic Article Title"),
			"content": helpers.NewStringElement("This is the dynamically inserted content for our article."),
		},
		Attributes: map[string]types.Attribute{
			"data-id": Data_("id", "12345"),
		},
	})

	// Output will be:
	// <div class="article" data-id="12345">
	//     <h2>Dynamic Article Title</h2>
	//     <p>This is the dynamically inserted content for our article.</p>
	// </div>
}

Contribute

Contributions to GoDOM are welcome! Feel free to open issues or submit pull requests.

Documentation

Overview

Package godom provides a comprehensive and fluent API for creating and manipulating DOM structures in Go.

The GoDOM library is inspired by the gomponents library, but it offers a unique take on DOM manipulation in Go. Instead of merely creating strings of HTML, GoDOM focuses on maintaining a live DOM-like structure, making it easier to manipulate, extend, and integrate with other Go packages.

Core Concepts:

1. **Elements**: At the heart of the library are Elements, which represent individual HTML elements. Elements can be nested, allowing for the creation of complex DOM structures. 2. **Attributes**: Attributes allow for the modification of Elements, adding things like classes, IDs, and other HTML attributes. 3. **Helpers**: The library provides helper functions for every HTML5 tag and attribute, making it easy to build any HTML structure. 4. **Utilities**: GoDOM provides utilities that allow for conditional rendering of elements and attributes, delayed rendering, and more.

Usage:

To create and render a simple HTML structure:

```go doc := Div(Class("container"))(

H1()(Content("Hello, GoDOM!")),
P()(Content("This is a simple example.")),

) var buf bytes.Buffer doc.Render(&buf) fmt.Println(buf.String()) ``` The GoDOM library can be extended with the template and util packages for more functionality.

For more complex examples and use cases, refer to the README and other package documentations.

Index

Constants

This section is empty.

Variables

View Source
var FormAttr = FormID

Functions

func A

func A(attrs ...types.Attribute) types.ElementFactory

The A tag defines a hyperlink, which is used to link from one page to another.

func Abbr

func Abbr(attrs ...types.Attribute) types.ElementFactory

The Abbr tag defines an abbreviation or an acronym.

func AbbrAttr

func AbbrAttr(abbreviation string) types.Attribute

The AbbrAttr attribute specifies an abbreviated version of the content in a header cell.

This attribute is allowed for: - TH

func Accept

func Accept(accept string) types.Attribute

The Accept attribute specifies a filter for what file types the user can pick from the file input dialog box.

This attribute is allowed for: - Input

func AcceptCharset

func AcceptCharset(characterSets ...string) types.Attribute

The AcceptCharset attribute specifies the character encodings that are to be used for the form submission.

This attribute is allowed for: - Form

func AccessKey

func AccessKey(key rune) types.Attribute

The AccessKey attribute specifies a shortcut key to activate/focus an element.

This is a global types.Attribute.

func Action

func Action(url string) types.Attribute

The Action attribute specifies where to send the form-data when a form is submitted.

This attribute is allowed for: - Form

func Address

func Address(attrs ...types.Attribute) types.ElementFactory

The Address tag defines the contact information for the author/owner of a document or an article.

func Allow

func Allow(policy string) types.Attribute

The Allow attribute specifies a feature policy for the IFrame

This attribute is allowed for: - IFrame

func Alt

func Alt(text string) types.Attribute

The Alt attribute specifies an alternate text for the Element.

This attribute is allowed for: - Area - Img - Input

func Area

func Area(attrs ...types.Attribute) types.ElementFactory

The Area tag defines an area inside an image map.

func Article

func Article(attrs ...types.Attribute) types.ElementFactory

The Article tag specifies independent, self-contained content.

func Aside

func Aside(attrs ...types.Attribute) types.ElementFactory

The Aside tag defines some content aside from the content it is placed in.

func Async

func Async() types.Attribute

The Async flag specifies that the Script is downloaded in parallel to parsing the page, and executed as soon as it is available (before parsing completes)

This flag is allowed for: - Script

func Audio

func Audio(attrs ...types.Attribute) types.ElementFactory

The Audio tag is used to embed sound content in a document, such as music or other audio streams.

func Autocomplete

func Autocomplete(on bool) types.Attribute

The Autocomplete attribute specifies whether a form should have autocomplete on or off

This attribute is allowed for: - Form - Input

func Autofocus

func Autofocus() types.Attribute

The Autofocus flag specifies that an Element should automatically get focus when the page loads.

This flag is allowed for: - Button - Input - Select - TextArea

func Autoplay

func Autoplay() types.Attribute

The Autoplay flag specifies that the audio or video will start playing as soon as it is ready.

This flag is allowed for: - Audio - Video

func B

func B(attrs ...types.Attribute) types.ElementFactory

The B tag specifies bold text without any extra importance.

func BDI

func BDI(attrs ...types.Attribute) types.ElementFactory

The BDI tag isolates a part of text that might be formatted in a different direction from other text outside it.

func BDO

func BDO(attrs ...types.Attribute) types.ElementFactory

The BDO tag is used to override the current text direction.

func Base

func Base(attrs ...types.Attribute) types.Element

The Base tag specifies the base URL and/or target for all relative URLs in a document.

func Blockquote

func Blockquote(attrs ...types.Attribute) types.ElementFactory

The Blockquote tag specifies a section that is quoted from another source.

func Body

func Body(attrs ...types.Attribute) types.ElementFactory

The Body tag defines the document's body.

func Br

func Br(attrs ...types.Attribute) types.Element

The Br tag inserts a single line break.

func Button

func Button(attrs ...types.Attribute) types.ElementFactory

The Button tag defines a clickable button.

func Canvas

func Canvas(attrs ...types.Attribute) types.ElementFactory

The Canvas tag is used to draw graphics, on the fly, via scripting (usually JavaScript).

func Caption

func Caption(attrs ...types.Attribute) types.ElementFactory

The Caption tag defines a table caption.

func Charset

func Charset(charset string) types.Attribute

The Charset attribute specifies the character encoding for the HTML document.

This attribute is allowed for: - Meta

func Checked

func Checked() types.Attribute

The Checked flag specifies that an Input element should be pre-selected when the page loads.

This flag is allowed for: - Input

func Cite

func Cite(attrs ...types.Attribute) types.ElementFactory

The Cite tag defines the title of a creative work (e.g. a book, a poem, a song, a movie, a painting, a sculpture, etc.).

func CiteAttr

func CiteAttr(url string) types.Attribute

The CiteAttr attribute specifies the source of the quotation or a URL to a document that explains the reason why the text inside a Del tag was deleted.

This attribute is allowed for: - Blockquote - Del - Ins - Q

Note: This attribute will render to `cite="<url>"`

func Class

func Class(classes ...string) types.Attribute

The Class attribute specifies one or more classnames for an element (refers to a class in a style sheet)

This is a global types.Attribute.

func Code

func Code(attrs ...types.Attribute) types.ElementFactory

The Code tag is used to define a piece of computer code. The content inside is displayed in the browser's default monospace font.

func Col

func Col(attrs ...types.Attribute) types.Element

The Col tag specifies column properties for each column within a ColGroup element.

func ColGroup

func ColGroup(attrs ...types.Attribute) types.ElementFactory

The ColGroup tag specifies a group of one or more columns in a table for formatting.

func ColSpan

func ColSpan(columns int) types.Attribute

The ColSpan attribute specifies the number of columns a cell should span

This attribute is allowed for: - TD - TH

func Cols

func Cols(width int) types.Attribute

The Cols attribute specifies the visible width of a TextArea

This attribute is allowed for: - TextArea

func Content

func Content(content string) types.Element

The Content types.Element renders the given content as HTML escaped text.

func ContentAttr

func ContentAttr(charset string) types.Attribute

The ContentAttr attribute specifies the value associated with the http-equiv or name attribute.

This attribute is allowed for: - Meta

func ContentEditable

func ContentEditable(editable bool) types.Attribute

The ContentEditable attribute specifies whether the content of an element is editable or not.

This is a global types.Attribute.

func Controls

func Controls() types.Attribute

The Controls flag specifies that audio or video controls should be displayed.

This flag is allowed for: - Audio - Video

func Coords

func Coords(coords string) types.Attribute

The Coords attribute specifies the coordinates of the area.

This attribute is allowed for: - Area

func CrossOrigin

func CrossOrigin(coords string) types.Attribute

The CrossOrigin allows images from third-party sites that allow cross-origin access.

This attribute is allowed for: - Img - Link - Script

func DD

func DD(attrs ...types.Attribute) types.ElementFactory

The DD tag is used to describe a term/name in a description list.

func DL

func DL(attrs ...types.Attribute) types.ElementFactory

The DL tag defines a description list.

func DT

func DT(attrs ...types.Attribute) types.ElementFactory

The DT tag defines a term/name in a description list.

func Data

func Data(attrs ...types.Attribute) types.ElementFactory

The Data tag is used to add a machine-readable translation of a given content.

func DataAttr

func DataAttr(url string) types.Attribute

The DataAttr specifies the URL of the resource to be used by the Object.

This attribute is allowed for: - Object

func DataList

func DataList(attrs ...types.Attribute) types.ElementFactory

The DataList tag specifies a list of pre-defined options for an <input> element.

func Data_

func Data_(key, value string) types.Attribute

The Data_ attributes are used to store custom data private to the page or application.

This is a global types.Attribute.

func DateTime

func DateTime(datetime time.Time) types.Attribute

The DateTime attribute specifies the date and time of when the text was deleted/changed.

This attribute is allowed for: - Del - Ins - Time

func Default

func Default() types.Attribute

The Default flag specifies that the track is to be enabled if the user's preferences do not indicate that another track would be more appropriate.

This flag is allowed for: - Track

func Defer

func Defer() types.Attribute

The Defer flag specifies that the script is downloaded in parallel to parsing the page, and executed after the page has finished parsing.

This flag is allowed for: - Script

func Del

func Del(attrs ...types.Attribute) types.ElementFactory

The Del tag defines text that has been deleted from a document.

func Details

func Details(attrs ...types.Attribute) types.ElementFactory

The Details tag specifies additional details that the user can open and close on demand.

func Dfn

func Dfn(attrs ...types.Attribute) types.ElementFactory

The Dfn tag stands for the "definition element", and it specifies a term that is going to be defined within the content.

func Dialog

func Dialog(attrs ...types.Attribute) types.ElementFactory

The Dialog tag defines a dialog box or subwindow.

func Dir

func Dir(direction string) types.Attribute

The Dir attribute specifies the text direction for the content in an Element

This is a global types.Attribute.

func DirName

func DirName(direction string) types.Attribute

The DirName attribute specifies t that the text direction will be submitted.

This attribute is allowed for: - Input - TextArea

func Disabled

func Disabled() types.Attribute

The Disabled flag specifies that an element should be disabled.

This flag is allowed for: - Button - FieldSet - Input - OptGroup - Option - Select - TextArea

func Div

func Div(attrs ...types.Attribute) types.ElementFactory

The Div tag defines a division or a section in an HTML document.

func Doctype

func Doctype() types.Element

The Doctype provides the DOCTYPE declaration

func Download

func Download(filename ...string) types.Attribute

The Download attribute specifies that the target will be downloaded when a user clicks on the hyperlink.

This attribute is allowed for: - A - Area

func Draggable

func Draggable(draggable bool) types.Attribute

The Draggable attribute specifies whether an Element is draggable or not.

This is a global types.Attribute.

func Em

func Em(attrs ...types.Attribute) types.ElementFactory

The Em tag is used to define emphasized text. The content inside is typically displayed in italic.

func Embed

func Embed(attrs ...types.Attribute) types.Element

The Embed tag defines a container for an external resource, such as a web page, a picture, a media player, or a plug-in application.

func EncType

func EncType(encoding string) types.Attribute

The EncType attribute specifies how the form-data should be encoded when submitting it to the server.

This attribute is allowed for: - Form

func FieldSet

func FieldSet(attrs ...types.Attribute) types.ElementFactory

The FieldSet tag is used to group related elements in a form.

func FigCaption

func FigCaption(attrs ...types.Attribute) types.ElementFactory

The FigCaption tag defines a caption for a Figure element.

func Figure

func Figure(attrs ...types.Attribute) types.ElementFactory

The Figure tag specifies self-contained content, like illustrations, diagrams, photos, code listings, etc.

func Footer(attrs ...types.Attribute) types.ElementFactory

The Footer tag defines a footer for a document or section.

func For

func For(elements ...string) types.Attribute

The For attribute specifies the id of the Form Element the Label or Option should be bound to.

This attribute is allowed for: - Label - Output

func Form

func Form(attrs ...types.Attribute) types.ElementFactory

The Form tag is used to create an HTML form for user input.

func FormAction

func FormAction(url string) types.Attribute

The FormAction attribute specifies where to send the form-data when a form is submitted.

This attribute is allowed for: - Button - Input

func FormEncType

func FormEncType(encoding string) types.Attribute

The FormEncType attribute specifies how form-data should be encoded before sending it to a server.

This attribute is allowed for: - Button - Input

func FormID

func FormID(formID string) types.Attribute

The FormID attribute specifies which form the button belongs to.

This attribute is allowed for: - Button - FieldSet - Input - Label - Meter - Object - Output - Select - TextArea

Note: This attribute will render to `form="<formID>"`

func FormMethod

func FormMethod(method string) types.Attribute

The FormMethod attribute specifies how to send the form-data (which HTTP method to use).

This attribute is allowed for: - Button - Input

func FormNoValidate

func FormNoValidate() types.Attribute

The FormNoValidate flag specifies that the form-data should not be validated on submission.

This attribute is allowed for: - Button - Input

func FormTarget

func FormTarget(target string) types.Attribute

The FormTarget attribute specifies where to display the response after submitting the form.

This attribute is allowed for: - Button - Input

func Group

func Group(children ...types.Element) types.Element

Group is a wrapper that can hold 0...N children. This allows to hold a full document or can be used in places where multiple elements are required, but only a single types.Element is allowed.

func H1

func H1(attrs ...types.Attribute) types.ElementFactory

The H1 tag is used to define a level 1 HTML Heading

func H2

func H2(attrs ...types.Attribute) types.ElementFactory

The H2 tag is used to define a level 2 HTML Heading

func H3

func H3(attrs ...types.Attribute) types.ElementFactory

The H3 tag is used to define a level 3 HTML Heading

func H4

func H4(attrs ...types.Attribute) types.ElementFactory

The H4 tag is used to define a level 4 HTML Heading

func H5

func H5(attrs ...types.Attribute) types.ElementFactory

The H5 tag is used to define a level 5 HTML Heading

func H6

func H6(attrs ...types.Attribute) types.ElementFactory

The H6 tag is used to define a level 6 HTML Heading

func HR

func HR(attrs ...types.Attribute) types.Element

The HR tag defines a thematic break in an HTML page (e.g. a shift of topic).

func HRef

func HRef(url string) types.Attribute

The HRef attribute specifies the URL of the page the link goes to.

This attribute is allowed for: - A - Area - Base - Link

func HRefLang

func HRefLang(languageCode string) types.Attribute

The HRefLang attribute specifies the language of the linked document.

This attribute is allowed for: - A - Area - Link

func HTML

func HTML(attrs ...types.Attribute) types.ElementFactory

The HTML tag represents the root of an HTML document.

func HTTPEquiv

func HTTPEquiv(equiv string) types.Attribute

The HTTPEquiv attribute provides an HTTP header for the information/value of the content attribute.

This attribute is allowed for: - Meta

func Head(attrs ...types.Attribute) types.ElementFactory

The Head element is a container for metadata (data about data) and is placed between the HTML tag and the Body tag.

func Header(attrs ...types.Attribute) types.ElementFactory

The Header element represents a container for introductory content or a set of navigational links.

func Headers

func Headers(headers ...string) types.Attribute

The Headers attribute specifies one or more header cells a cell is related to

This attribute is allowed for: - TD - TH

func Height

func Height(pixels int) types.Attribute

The Height attribute specifies the height of an Element.

This attribute is allowed for: - Canvas - Embed - IFrame - Img - Input - Object - Video

func Hidden

func Hidden() types.Attribute

The Hidden flag specifies the range that is considered to be a high value.

This is a global types.Attribute.

func High

func High(high int) types.Attribute

The High attribute specifies the range that is considered to be a high value.

This attribute is allowed for: - Meter

func I

func I(attrs ...types.Attribute) types.ElementFactory

The I tag defines a part of text in an alternate voice or mood. The content inside is typically displayed in italic.

func ID

func ID(id string) types.Attribute

The ID attribute specifies a unique id for an element

This is a global types.Attribute.

func IFrame

func IFrame(attrs ...types.Attribute) types.Element

The IFrame tag specifies an inline frame.

func Img

func Img(attrs ...types.Attribute) types.Element

The Img tag is used to embed an image in an HTML page.

func Input

func Input(attrs ...types.Attribute) types.Element

The Input tag specifies an input field where the user can enter data.

func Ins

func Ins(attrs ...types.Attribute) types.ElementFactory

The Ins tag defines a text that has been inserted into a document.

func Integrity

func Integrity(hash string) types.Attribute

The Integrity attribute allows a browser to check the fetched script to ensure that the code is never loaded if the source has been manipulated.

This attribute is allowed for: - Script

func IsMap

func IsMap() types.Attribute

The IsMap flag specifies an image as a server-side image map.

This attribute is allowed for: - Img

func Kbd

func Kbd(attrs ...types.Attribute) types.ElementFactory

The Kbd tag is used to define keyboard input. The content inside is displayed in the browser's default monospace font.

func Kind

func Kind(kind string) types.Attribute

The Kind attribute specifies the kind of text track.

This attribute is allowed for: - Track

func Label

func Label(attrs ...types.Attribute) types.ElementFactory

The Label tag defines a label for several elements: - Input - Meter - Progress - Select - Textarea

func LabelAttr

func LabelAttr(label string) types.Attribute

The LabelAttr attribute specifies a label for an OptGroup, Option or Track.

This attribute is allowed for: - OptGroup - Option - Track

func Lang

func Lang(lang string) types.Attribute

The Lang attribute specifies the language of the Element's content.

This is a global types.Attribute.

func Legend

func Legend(attrs ...types.Attribute) types.ElementFactory

The Legend tag defines a caption for the FieldSet element.

func Li

func Li(attrs ...types.Attribute) types.ElementFactory

The Li tag defines a list item.

func Link(attrs ...types.Attribute) types.Element

The Link tag defines the relationship between the current document and an external resource.

func List

func List(dataListID string) types.Attribute

The List attribute refers to a DataList element that contains pre-defined options for an Input element

This attribute is allowed for: - Input

func Loading

func Loading(loading string) types.Attribute

The Loading attribute specifies whether a browser should load an Element immediately or to defer loading of iframes until some conditions are met.

This attribute is allowed for: - IFrame - Img

func LongDesc

func LongDesc(url string) types.Attribute

The LongDesc attribute specifies a URL to a detailed description of an image.

This attribute is allowed for: - Img

func Loop

func Loop() types.Attribute

The Loop flag specifies that the audio or video will start over again, every time it is finished.

This attribute is allowed for: - Audio - Video

func Low

func Low(low int) types.Attribute

The Low attribute specifies the range that is considered to be a low value.

This attribute is allowed for: - Meter

func Main

func Main(attrs ...types.Attribute) types.ElementFactory

The Main tag specifies the main content of a document.

func Map

func Map(attrs ...types.Attribute) types.ElementFactory

The Map tag is used to define an image map. An image map is an image with clickable areas.

func Mark

func Mark(attrs ...types.Attribute) types.ElementFactory

The Mark tag defines text that should be marked or highlighted.

func Max

func Max[T MinMaxType](max T) types.Attribute

The Max attribute specifies the maximum value for an Input or Meter element.

This attribute is allowed for: - Input - Meter - Progress

func MaxLength

func MaxLength(length int) types.Attribute

The MaxLength attribute specifies the maximum number of characters allowed in an Input element.

This attribute is allowed for: - Input - TextArea

func Media

func Media(mediaQuery string) types.Attribute

The Media attribute specifies what media/device the linked document is optimized for.

This attribute is allowed for: - A - Area - Link - Source - Style

func Meta

func Meta(attrs ...types.Attribute) types.Element

The Meta tag defines metadata about an HTML document. Metadata is data (information) about data.

func Meter

func Meter(attrs ...types.Attribute) types.ElementFactory

The Meter tag defines a scalar measurement within a known range, or a fractional value. This is also known as a gauge.

func Method

func Method(method string) types.Attribute

The Method attribute specifies the HTTP method to use when sending form-data.

This attribute is allowed for: - Form

func Min

func Min[T MinMaxType](min T) types.Attribute

The Min attribute specifies a minimum value for an Input or Meter element

This attribute is allowed for: - Input - Meter

func MinLength

func MinLength(length int) types.Attribute

The MinLength attribute specifies the minimum number of characters required in an Input element.

This attribute is allowed for: - Input

func Multiple

func Multiple() types.Attribute

The Multiple flag specifies that a user can enter more than one value in an Input element.

This attribute is allowed for: - Input - Select

func Muted

func Muted() types.Attribute

The Muted flag specifies that the audio output should be muted.

This flag is allowed for: - Audio - Video

func Name

func Name(name string) types.Attribute

The Name attribute specifies a name for an Element.

This flag is allowed for: - Button - FieldSet - Form - IFrame - Input - Map - Meta - Object - Output - Param - Select - TextArea

func Nav(attrs ...types.Attribute) types.ElementFactory

The Nav tag defines a set of navigation links.

func NoModule

func NoModule(noModule bool) types.Attribute

The NoModule attribute specifies that the script should not be executed in browsers supporting ES2015 modules.

This flag is allowed for: - Script

func NoScript

func NoScript(attrs ...types.Attribute) types.ElementFactory

The NoScript tag defines an alternate content to be displayed to users that have disabled scripts in their browser or have a browser that doesn't support script.

func NoValidate

func NoValidate() types.Attribute

The NoValidate flag specifies that the form should not be validated when submitted.

This attribute is allowed for: - Form

func OL

func OL(attrs ...types.Attribute) types.ElementFactory

The OL tag defines an ordered list. An ordered list can be numerical or alphabetical.

func Object

func Object(attrs ...types.Attribute) types.ElementFactory

The Object tag defines a container for an external resource.

func OnAbort

func OnAbort(script string) types.Attribute

The OnAbort attribute specifies a script to be run on abort.

This is a global types.Attribute.

func OnAfterPrint

func OnAfterPrint(script string) types.Attribute

The OnAfterPrint attribute specifies a script to be run after the document is printed.

This is a global types.Attribute.

func OnBeforePrint

func OnBeforePrint(script string) types.Attribute

The OnBeforePrint attribute specifies a script to be run before the document is printed.

This is a global types.Attribute.

func OnBeforeUnload

func OnBeforeUnload(script string) types.Attribute

The OnBeforeUnload attribute specifies a script to be run when the document is about to be unloaded.

This is a global types.Attribute.

func OnBlur

func OnBlur(script string) types.Attribute

The OnBlur attribute specifies a script to be run the moment that the Element loses focus.

This is a global types.Attribute.

func OnCanPlay

func OnCanPlay(script string) types.Attribute

The OnCanPlay attribute specifies a script to be run when a file is ready to start playing.

This is a global types.Attribute.

func OnCanPlayThrough

func OnCanPlayThrough(script string) types.Attribute

The OnCanPlayThrough attribute specifies a script to be run when a file can be played all the way to the end without pausing for buffering.

This is a global types.Attribute.

func OnChange

func OnChange(script string) types.Attribute

The OnChange attribute specifies a script to be run the moment when the value of the Element is changed.

This is a global types.Attribute.

func OnClick

func OnClick(script string) types.Attribute

The OnClick attribute specifies a script to be run on a mouse click on the Element.

This is a global types.Attribute.

func OnContextMenu

func OnContextMenu(script string) types.Attribute

The OnContextMenu attribute specifies a script to be run when a context menu is triggered.

This is a global types.Attribute.

func OnCopy

func OnCopy(script string) types.Attribute

The OnCopy attribute specifies a script to be run when the user copies the content of an element.

This is a global types.Attribute.

func OnCueChange

func OnCueChange(script string) types.Attribute

The OnCueChange attribute specifies a script to be run when the cue changes in a Track element.

This is a global types.Attribute.

func OnCut

func OnCut(script string) types.Attribute

The OnCut attribute specifies a script to be run when the user cuts the content of an element.

This is a global types.Attribute.

func OnDoubleClick

func OnDoubleClick(script string) types.Attribute

The OnDoubleClick attribute specifies a script to be run on a mouse double-click on the Element.

This is a global types.Attribute.

func OnDrag

func OnDrag(script string) types.Attribute

The OnDrag attribute specifies a script to be run when an element is dragged.

This is a global types.Attribute.

func OnDragEnd

func OnDragEnd(script string) types.Attribute

The OnDragEnd attribute specifies a script to be run at the end of a drag operation.

This is a global types.Attribute.

func OnDragEnter

func OnDragEnter(script string) types.Attribute

The OnDragEnter attribute specifies a script to be run when an element has been dragged to a valid drop target.

This is a global types.Attribute.

func OnDragLeave

func OnDragLeave(script string) types.Attribute

The OnDragLeave attribute specifies a script to be run when an element leaves a valid drop target.

This is a global types.Attribute.

func OnDragOver

func OnDragOver(script string) types.Attribute

The OnDragOver attribute specifies a script to be run when an element is being dragged over a valid drop target.

This is a global types.Attribute.

func OnDragStart

func OnDragStart(script string) types.Attribute

The OnDragStart attribute specifies a script to be run at the start of a drag operation.

This is a global types.Attribute.

func OnDrop

func OnDrop(script string) types.Attribute

The OnDrop attribute specifies a script to be run when dragged element is being dropped.

This is a global types.Attribute.

func OnDurationChange

func OnDurationChange(script string) types.Attribute

The OnDurationChange attribute specifies a script to be run when the length of the media changes.

This is a global types.Attribute.

func OnEmptied

func OnEmptied(script string) types.Attribute

The OnEmptied attribute specifies a script to be run when something bad happens and the file is suddenly unavailable.

This is a global types.Attribute.

func OnEnded

func OnEnded(script string) types.Attribute

The OnEnded attribute specifies a script to be run when the media has reach the end.

This is a global types.Attribute.

func OnError

func OnError(script string) types.Attribute

The OnError attribute specifies a script to be run when an error occurs.

This is a global types.Attribute.

func OnFocus

func OnFocus(script string) types.Attribute

The OnFocus attribute specifies a script to be run the moment when the Element gets focus.

This is a global types.Attribute.

func OnHashChange

func OnHashChange(script string) types.Attribute

The OnHashChange attribute specifies a script to be run when there has been changes to the anchor part of the URL.

This is a global types.Attribute.

func OnInput

func OnInput(script string) types.Attribute

The OnInput attribute specifies a script to be run when an Element gets user input.

This is a global types.Attribute.

func OnInvalid

func OnInvalid(script string) types.Attribute

The OnInvalid attribute specifies a script to be run when an Element is invalid.

This is a global types.Attribute.

func OnKeyDown

func OnKeyDown(script string) types.Attribute

The OnKeyDown attribute specifies a script to be run when a user is pressing a key.

This is a global types.Attribute.

func OnKeyPress

func OnKeyPress(script string) types.Attribute

The OnKeyPress attribute specifies a script to be run when a user presses a key.

This is a global types.Attribute.

func OnKeyUp

func OnKeyUp(script string) types.Attribute

The OnKeyUp attribute specifies a script to be run when a user releases a key.

This is a global types.Attribute.

func OnLoad

func OnLoad(script string) types.Attribute

The OnLoad attribute specifies a script to be run after the page is finished loading.

This is a global types.Attribute.

func OnLoadStart

func OnLoadStart(script string) types.Attribute

The OnLoadStart attribute specifies a script to be run just as the file begins to load before anything is actually loaded.

This is a global types.Attribute.

func OnLoadedData

func OnLoadedData(script string) types.Attribute

The OnLoadedData attribute specifies a script to be run when media data is loaded.

This is a global types.Attribute.

func OnLoadedMetaData

func OnLoadedMetaData(script string) types.Attribute

The OnLoadedMetaData attribute specifies a script to be run when meta data (like dimensions and duration) are loaded.

This is a global types.Attribute.

func OnMessage

func OnMessage(script string) types.Attribute

The OnMessage attribute specifies a script to be run when the message is triggered.

This is a global types.Attribute.

func OnMouseDown

func OnMouseDown(script string) types.Attribute

The OnMouseDown attribute specifies a script to be run when a mouse button is pressed down on an element.

This is a global types.Attribute.

func OnMouseMove

func OnMouseMove(script string) types.Attribute

The OnMouseMove attribute specifies a script to be run when the mouse pointer is moving while it is over an element.

This is a global types.Attribute.

func OnMouseOut

func OnMouseOut(script string) types.Attribute

The OnMouseOut attribute specifies a script to be run when the mouse pointer moves out of an element.

This is a global types.Attribute.

func OnMouseOver

func OnMouseOver(script string) types.Attribute

The OnMouseOver attribute specifies a script to be run when the mouse pointer moves over an element.

This is a global types.Attribute.

func OnMouseUp

func OnMouseUp(script string) types.Attribute

The OnMouseUp attribute specifies a script to be run when a mouse button is released over an element.

This is a global types.Attribute.

func OnOffline

func OnOffline(script string) types.Attribute

The OnOffline attribute specifies a script to be run when the browser starts to work offline.

This is a global types.Attribute.

func OnOnline

func OnOnline(script string) types.Attribute

The OnOnline attribute specifies a script to be run when the browser starts to work online.

This is a global types.Attribute.

func OnPageHide

func OnPageHide(script string) types.Attribute

The OnPageHide attribute specifies a script to be run when a user navigates away from a page.

This is a global types.Attribute.

func OnPageShow

func OnPageShow(script string) types.Attribute

The OnPageShow attribute specifies a script to be run when a user navigates to a page.

This is a global types.Attribute.

func OnPaste

func OnPaste(script string) types.Attribute

The OnPaste attribute specifies a script to be run when the user pastes some content in an element.

This is a global types.Attribute.

func OnPause

func OnPause(script string) types.Attribute

The OnPause attribute specifies a script to be run when the media is paused either by the user or programmatically.

This is a global types.Attribute.

func OnPlay

func OnPlay(script string) types.Attribute

The OnPlay attribute specifies a script to be run when the media is ready to start playing.

This is a global types.Attribute.

func OnPlaying

func OnPlaying(script string) types.Attribute

The OnPlaying attribute specifies a script to be run when the media actually has started playing.

This is a global types.Attribute.

func OnPopState

func OnPopState(script string) types.Attribute

The OnPopState attribute specifies a script to be run when the window's history changes.

This is a global types.Attribute.

func OnProgress

func OnProgress(script string) types.Attribute

The OnProgress attribute specifies a script to be run when the browser is in the process of getting the media data.

This is a global types.Attribute.

func OnRateChange

func OnRateChange(script string) types.Attribute

The OnRateChange attribute specifies a script to be run each time the playback rate changes.

This is a global types.Attribute.

func OnReset

func OnReset(script string) types.Attribute

The OnReset attribute specifies a script to be run when the Reset Button in a form is clicked.

This is a global types.Attribute.

func OnResize

func OnResize(script string) types.Attribute

The OnResize attribute specifies a script to be run when the browser window is resized.

This is a global types.Attribute.

func OnScroll

func OnScroll(script string) types.Attribute

The OnScroll attribute specifies a script to be run when an element's scrollbar is being scrolled.

This is a global types.Attribute.

func OnSearch

func OnSearch(script string) types.Attribute

The OnSearch attribute specifies a script to be run when the user writes something in a search field.

This is a global types.Attribute.

func OnSeeked

func OnSeeked(script string) types.Attribute

The OnSeeked attribute specifies a script to be run when the seeking attribute is set to false indicating that seeking has ended.

This is a global types.Attribute.

func OnSeeking

func OnSeeking(script string) types.Attribute

The OnSeeking attribute specifies a script to be run when the seeking attribute is set to true indicating that seeking is active.

This is a global types.Attribute.

func OnSelect

func OnSelect(script string) types.Attribute

The OnSelect attribute specifies a script to be run after some text has been selected in an Element.

This is a global types.Attribute.

func OnStalled

func OnStalled(script string) types.Attribute

The OnStalled attribute specifies a script to be run when the browser is unable to fetch the media data for whatever reason.

This is a global types.Attribute.

func OnStorage

func OnStorage(script string) types.Attribute

The OnStorage attribute specifies a script to be run when a Web Storage area is updated.

This is a global types.Attribute.

func OnSubmit

func OnSubmit(script string) types.Attribute

The OnSubmit attribute specifies a script to be run when a Form is submitted.s

This flag is allowed for: - Form

func OnSuspend

func OnSuspend(script string) types.Attribute

The OnSuspend attribute specifies a script to be run when fetching the media data is stopped before it is completely loaded for whatever reason.

This is a global types.Attribute.

func OnTimeUpdate

func OnTimeUpdate(script string) types.Attribute

The OnTimeUpdate attribute specifies a script to be run when the playing position has changed.

This is a global types.Attribute.

func OnToggle

func OnToggle(script string) types.Attribute

The OnToggle attribute specifies a script to be run when the user opens or closes the Details element.

This is a global types.Attribute.

func OnUnload

func OnUnload(script string) types.Attribute

The OnUnload attribute specifies a script to be run once the page has unloaded (or the browser window has been closed).

This is a global types.Attribute.

func OnVolumeChange

func OnVolumeChange(script string) types.Attribute

The OnVolumeChange attribute specifies a script to be run each time the volume is changed which.

This is a global types.Attribute.

func OnWaiting

func OnWaiting(script string) types.Attribute

The OnWaiting attribute specifies a script to be run when the media has paused but is expected to resume.

This is a global types.Attribute.

func OnWheel

func OnWheel(script string) types.Attribute

The OnWheel attribute specifies a script to be run when the mouse wheel rolls up or down over an element.

This is a global types.Attribute.

func Open

func Open() types.Attribute

The Open flag specifies that an Element should be visible (open) to the user.

This flag is allowed for: - Details - Dialog

func OptGroup

func OptGroup(attrs ...types.Attribute) types.ElementFactory

The OptGroup tag is used to group related options in a Select element (drop-down list).

func Optimum

func Optimum(optimum int) types.Attribute

The Optimum attribute specifies what value is the optimal value for the gauge.

This attribute is allowed for: - Meter

func Option

func Option(attrs ...types.Attribute) types.ElementFactory

The Option tag defines an option in a Select list.

func Output

func Output(attrs ...types.Attribute) types.ElementFactory

The Output tag is used to represent the result of a calculation (like one performed by a script).

func P

func P(attrs ...types.Attribute) types.ElementFactory

The P tag defines a paragraph.

func Param

func Param(attrs ...types.Attribute) types.Element

The Param tag is used to define parameters for an Object element.

func Pattern

func Pattern(pattern string) types.Attribute

The Pattern specifies a JavaScript regular expression that an Input element's value is checked against.

This attribute is allowed for: - Input

func Picture

func Picture(attrs ...types.Attribute) types.ElementFactory

The Picture tag gives web developers more flexibility in specifying image resources.

func Ping

func Ping(urls ...string) types.Attribute

The Ping attribute specifies a list of URLs to which, when the link is followed, post requests with the body ping will be sent by the browser.

This attribute is allowed for: - A

func Placeholder

func Placeholder(placeholder string) types.Attribute

The Placeholder attribute specifies a short hint that describes the expected value of an Input element.

This attribute is allowed for: - Input - TextArea

func Poster

func Poster(url string) types.Attribute

The Poster attribute specifies an image to be shown while the Video is downloading, or until the user hits the play button.

This attribute is allowed for: - Video

func Pre

func Pre(attrs ...types.Attribute) types.ElementFactory

The Pre tag defines preformatted text.

func Preload

func Preload(preload string) types.Attribute

The Preload attribute specifies if and how the author thinks the audio or video should be loaded when the page loads.

This attribute is allowed for: - Audio - Video

func Progress

func Progress(attrs ...types.Attribute) types.ElementFactory

The Progress tag represents the completion progress of a task.

func Q

func Q(attrs ...types.Attribute) types.ElementFactory

The Q tag defines a short quotation.

func RP

func RP(attrs ...types.Attribute) types.ElementFactory

The RP tag can be used to provide parentheses around a ruby text, to be shown by browsers that do not support ruby annotations.

func RT

func RT(attrs ...types.Attribute) types.ElementFactory

The RT tag defines an explanation or pronunciation of characters (for East Asian typography) in a ruby annotation.

func ReadOnly

func ReadOnly() types.Attribute

The ReadOnly flag specifies that an Input field is read-only

This flag is allowed for: - Input - TextArea

func ReferrerPolicy

func ReferrerPolicy(policy string) types.Attribute

The ReferrerPolicy attribute specifies which referrer information to send with the link, IFrame or Img.

This attribute is allowed for: - A - Area - IFrame - Img - Link - Script

func Rel

func Rel(relationship string) types.Attribute

The Rel attribute specifies the relationship between the current document and the linked document.

This attribute is allowed for: - A - Area - Form - Link

func Required

func Required() types.Attribute

The Required flag specifies that an Input field must be filled out before submitting the form.

This flag is allowed for: - Input - Select - TextArea

func Reversed

func Reversed() types.Attribute

The Reversed flag specifies that the list order should be reversed (9,8,7...)

This flag is allowed for: - OL

func RowSpan

func RowSpan(rows int) types.Attribute

The RowSpan attribute sets the number of rows a cell should span.

This attribute is allowed for: - TD - TH

func Rows

func Rows(rows int) types.Attribute

The Rows attribute sets the visible number of lines in a TextArea.

This attribute is allowed for: - TextArea

func Ruby

func Ruby(attrs ...types.Attribute) types.ElementFactory

The Ruby tag specifies a ruby annotation.

func S

func S(attrs ...types.Attribute) types.ElementFactory

The S tag specifies text that is no longer correct, accurate or relevant. The text will be displayed with a line through it.

func SVG

func SVG(attrs ...types.Attribute) types.ElementFactory

The SVG tag defines a container for svg graphics.

func Samp

func Samp(attrs ...types.Attribute) types.ElementFactory

The Samp tag is used to define sample output from a computer program. The content inside is displayed in the browser's default monospace font.

func Sandbox

func Sandbox(restrictions ...string) types.Attribute

The Sandbox attribute enables an extra set of restrictions for the content in an IFrame.

This attribute is allowed for: - IFrame

func Scope

func Scope(scope string) types.Attribute

The Scope attribute specifies whether a header cell is a header for a column, row, or group of columns or rows.

This attribute is allowed for: - TH

func Script

func Script(attrs ...types.Attribute) types.ElementFactory

The Script tag is used to embed a client-side script (JavaScript).

func Section

func Section(attrs ...types.Attribute) types.ElementFactory

The Section tag defines a section in a document.

func Select

func Select(attrs ...types.Attribute) types.ElementFactory

The Select element is used to create a drop-down list.

func Selected

func Selected() types.Attribute

The Selected flag specifies that an Option should be pre-selected when the page loads

This attribute is allowed for: - Option

func Shape

func Shape(shape string) types.Attribute

The Shape attribute specifies the shape of the area.

This attribute is allowed for: - Area

func Size

func Size(size int) types.Attribute

The Size attribute specifies the width, in characters, of an Input element or the number of visible options in the Select list

This attribute is allowed for: - Input - Select

func Sizes

func Sizes(sizes string) types.Attribute

The Sizes attribute specifies image sizes for different page layouts.

This attribute is allowed for: - Img - Link - Source

func Small

func Small(attrs ...types.Attribute) types.ElementFactory

The Small tag defines smaller text (like copyright and other side-comments).

func Source

func Source(attrs ...types.Attribute) types.Element

The Source tag is used to specify multiple media resources for media elements, such as Video, Audio, and Picture.

func Span

func Span(attrs ...types.Attribute) types.ElementFactory

The Span tag is an inline container used to mark up a part of a text, or a part of a document.

func SpanAttr

func SpanAttr(columns int) types.Attribute

The SpanAttr attribute specifies the number of columns a Col or ColGroup should span

This attribute is allowed for: - Col - ColGroup

Note: This attribute will render to `span="<columns>"`

func Spellcheck

func Spellcheck(check bool) types.Attribute

The Spellcheck attribute specifies whether the element is to have its spelling and grammar checked or not

This is a global types.Attribute.

func Src

func Src(url string) types.Attribute

The Src attribute specifies the URL of external content for an Element.

This attribute is allowed for: - Audio - Embed - IFrame - Img - Input - Script - Source - Track - Video

func SrcDoc

func SrcDoc(elements ...types.Element) types.Attribute

The SrcDoc attribute specifies the HTML content of the page to show in the IFrame

This attribute is allowed for: - IFrame

func SrcLang

func SrcLang(lang string) types.Attribute

The SrcLang attribute specifies the language of the track text data.

This attribute is allowed for: - Track

func SrcSet

func SrcSet(urlList string) types.Attribute

The SrcSet attribute specifies a list of image files to use in different situations.

This attribute is allowed for: - Img - Source

func Start

func Start(start int) types.Attribute

The Start attribute specifies the start value of an ordered list.

This attribute is allowed for: - OL

func Step

func Step[T NumOrString](step T) types.Attribute

The Step attribute specifies the interval between legal numbers in an Input field.

This attribute is allowed for: - Input

func Strong

func Strong(attrs ...types.Attribute) types.ElementFactory

The Strong tag is used to define text with strong importance. The content inside is typically displayed in bold.

func Style

func Style(attrs ...types.Attribute) types.ElementFactory

The Style tag is used to define style information (CSS) for a document.

func StyleAttr

func StyleAttr(style string) types.Attribute

The StyleAttr attribute specifies an inline CSS style for an Element.

This is a global types.Attribute.

func Sub

func Sub(attrs ...types.Attribute) types.ElementFactory

The Sub tag defines subscript text.

func Summary

func Summary(attrs ...types.Attribute) types.ElementFactory

The Summary tag defines a visible heading for the Details element. The heading can be clicked to view/hide the details.

func Sup

func Sup(attrs ...types.Attribute) types.ElementFactory

The Sup tag defines superscript text.

func TBody

func TBody(attrs ...types.Attribute) types.ElementFactory

The TBody tag is used to group the body content in an HTML Table.

func TD

func TD(attrs ...types.Attribute) types.ElementFactory

The TD tag defines a standard data cell in an HTML Table.

func TFoot

func TFoot(attrs ...types.Attribute) types.ElementFactory

The TFoot tag is used to group footer content in an HTML Table.

func TH

func TH(attrs ...types.Attribute) types.ElementFactory

The TH tag defines a header cell in an HTML Table.

func THead

func THead(attrs ...types.Attribute) types.ElementFactory

The THead tag is used to group header content in an HTML Table.

func TR

func TR(attrs ...types.Attribute) types.ElementFactory

The TR tag defines a row in an HTML Table.

func TabIndex

func TabIndex(idx int) types.Attribute

The TabIndex attribute specifies the tabbing order of an Element.

This is a global types.Attribute.

func Table

func Table(attrs ...types.Attribute) types.ElementFactory

The Table tag defines an HTML table.

func Target

func Target(target string) types.Attribute

The Target attribute specifies where to open the linked document.

This attribute is allowed for: - A - Area - Base - Form

func Template

func Template(attrs ...types.Attribute) types.ElementFactory

The Template tag is used as a container to hold some HTML content hidden from the user when the page loads.

func TextArea

func TextArea(attrs ...types.Attribute) types.ElementFactory

The TextArea tag defines a multi-line text input control.

func Time

func Time(attrs ...types.Attribute) types.ElementFactory

The Time tag defines a specific time (or datetime).

func Title

func Title(attrs ...types.Attribute) types.ElementFactory

The Title tag defines the title of the document.

func TitleAttr

func TitleAttr(title string) types.Attribute

The TitleAttr attribute specifies extra information about an element.

This is a global types.Attribute.

func Track

func Track(attrs ...types.Attribute) types.Element

The Track tag specifies text tracks for Audio or Video elements.

func Translate

func Translate(translate bool) types.Attribute

The Translate attribute specifies extra information about an element.

This is a global types.Attribute.

func Type

func Type(typ string) types.Attribute

The Type attribute specifies the media type of the linked document, or the type of an Element.

This attribute is allowed for: - A - Area - Button - Embed - Input - Link - Object - OL - Script - Source - Style

func TypeMustMatch

func TypeMustMatch(mustMatch bool) types.Attribute

The TypeMustMatch attribute specifies whether the type attribute and the actual content of the resource must match to be displayed.

This attribute is allowed for: - Object

func U

func U(attrs ...types.Attribute) types.ElementFactory

The U tag represents some text that is unarticulated and styled differently from normal text.

func UL

func UL(attrs ...types.Attribute) types.ElementFactory

The UL tag defines an unordered (bulleted) list.

func UseMap

func UseMap(mapName string) types.Attribute

The UseMap attribute specifies an image as a client-side image map.

This attribute is allowed for: - Img - Object

func Value

func Value[T NumOrString](value T) types.Attribute

The Value attribute specifies an initial value for the Element or the machine-readable translation of the content of a Data element.

This attribute is allowed for: - Button - Data - Input - Li - Meter - Option - Param - Progress

func Var

func Var(attrs ...types.Attribute) types.ElementFactory

The Var tag is used to defines a variable in programming or in a mathematical expression.

func Video

func Video(attrs ...types.Attribute) types.ElementFactory

The Video tag is used to embed video content in a document, such as a movie clip or other video streams.

func WBr

func WBr(attrs ...types.Attribute) types.Element

The WBr (Word Break Opportunity) tag specifies where in a text it would be ok to add a line-break.

func Width

func Width(pixels int) types.Attribute

The Width attribute specifies the width of an Element.

This attribute is allowed for: - Canvas - Embed - IFrame - Img - Input - Object - Video

func Wrap

func Wrap(wrap string) types.Attribute

The Wrap attribute specifies how the text in a TextArea is to be wrapped when submitted in a form.

This attribute is allowed for: - TextArea

func XMLNS

func XMLNS(namespace string) types.Attribute

The XMLNS attribute specifies the XML namespace attribute.

This attribute is allowed for: - HTML

Types

type MinMaxType

type MinMaxType interface {
	int | int32 | int64 | float32 | float64 | time.Time | string
}

type NumOrString

type NumOrString interface {
	int | int32 | int64 | float32 | float64 | string
}

Directories

Path Synopsis
Package helpers provides utility functions and types to simplify and enhance the creation and manipulation of godom elements and attributes.
Package helpers provides utility functions and types to simplify and enhance the creation and manipulation of godom elements and attributes.
Package template provides a high-level wrapper around the standard html/template package, enabling seamless integration with the godom library.
Package template provides a high-level wrapper around the standard html/template package, enabling seamless integration with the godom library.
Package util provides utility functions for godom package, enhancing the flexibility and ease of use in creating and manipulating the DOM.
Package util provides utility functions for godom package, enhancing the flexibility and ease of use in creating and manipulating the DOM.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL