element

package
v0.5.6 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package element provides type-safe representations of HTML tags and helper functions for working with generic elements in templated code.

It defines the Tag type and a set of constants for common HTML tags, including semantic elements, form controls, media elements, and text elements. The IsValid method allows runtime validation of tag names.

This package is intended for internal use by higher-level components or wrappers that generate HTML via templates, providing a consistent way to refer to HTML tags across your codebase.

Copyright 2025 Deirror. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Element

func Element(t Tag, prvs ...props.AttrsProvider) templ.Component

Element renders a standard HTML element with a given tag and attributes.

func VoidElement

func VoidElement(t Tag, prvs ...props.AttrsProvider) templ.Component

VoidElement renders a self-closing HTML element with a given tag and attributes.

Types

type Tag

type Tag string
const (
	HTML       Tag = "html"
	Head       Tag = "head"
	Body       Tag = "body"
	Header     Tag = "header"
	Main       Tag = "main"
	Footer     Tag = "footer"
	Button     Tag = "button"
	A          Tag = "a"
	Div        Tag = "div"
	Option     Tag = "option"
	Select     Tag = "select"
	Fieldset   Tag = "fieldset"
	Form       Tag = "form"
	Input      Tag = "input"
	Label      Tag = "label"
	Audio      Tag = "audio"
	Canvas     Tag = "canvas"
	Figcaption Tag = "figcaption"
	Figure     Tag = "figure"
	Img        Tag = "img"
	Source     Tag = "source"
	Video      Tag = "video"
	Meter      Tag = "meter"
	Progress   Tag = "progress"
	Article    Tag = "article"
	Details    Tag = "details"
	Hr         Tag = "hr"
	Nav        Tag = "nav"
	Section    Tag = "section"
	Summary    Tag = "summary"
	Table      Tag = "table"
	TBody      Tag = "tbody"
	Th         Tag = "th"
	Td         Tag = "td"
	THead      Tag = "thead"
	Tr         Tag = "tr"
	P          Tag = "p"
	H1         Tag = "h1"
	H2         Tag = "h2"
	H3         Tag = "h3"
	H4         Tag = "h4"
	H5         Tag = "h5"
	H6         Tag = "h6"
	Span       Tag = "span"
	Pre        Tag = "pre"
	Code       Tag = "code"
	Blockquote Tag = "blockquote"
	Ul         Tag = "ul"
	Ol         Tag = "ol"
	Li         Tag = "li"
	Dl         Tag = "dl"
	Dt         Tag = "dt"
	Dd         Tag = "dd"
	Strong     Tag = "strong"
	B          Tag = "b"
	Em         Tag = "em"
	I          Tag = "i"
	Small      Tag = "small"
	Mark       Tag = "mark"
	Del        Tag = "del"
	Abbr       Tag = "abbr"
	Ins        Tag = "ins"
	Kbd        Tag = "kbd"
	S          Tag = "s"
	U          Tag = "u"
	Sub        Tag = "sub"
	Sup        Tag = "sup"
	Textarea   Tag = "textarea"
	Br         Tag = "br"
)

func (Tag) IsValid

func (t Tag) IsValid() bool

Jump to

Keyboard shortcuts

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