Documentation
¶
Index ¶
- Variables
- func If(condition bool, element templ.Component) templ.Component
- func IfElse(condition bool, truthyElement, falsyElement templ.Component) templ.Component
- func Map[T any](items []T, transform func(item T) templ.Component) []templ.Component
- func Range(start, end int, transform func(i int) templ.Component) []templ.Component
- func Version() string
- type Attrs
- type ContentType
- type Element
- func A(attrs Attrs, children ...templ.Component) *Element
- func Address(attrs Attrs, children ...templ.Component) *Element
- func Article(attrs Attrs, children ...templ.Component) *Element
- func Aside(attrs Attrs, children ...templ.Component) *Element
- func B(attrs Attrs, children ...templ.Component) *Element
- func BR(attrs Attrs) *Element
- func Blockquote(attrs Attrs, children ...templ.Component) *Element
- func Body(attrs Attrs, children ...templ.Component) *Element
- func Button(attrs Attrs, children ...templ.Component) *Element
- func Caption(attrs Attrs, children ...templ.Component) *Element
- func DD(attrs Attrs, children ...templ.Component) *Element
- func DL(attrs Attrs, children ...templ.Component) *Element
- func DT(attrs Attrs, children ...templ.Component) *Element
- func Details(attrs Attrs, children ...templ.Component) *Element
- func Dialog(attrs Attrs, children ...templ.Component) *Element
- func Div(attrs Attrs, children ...templ.Component) *Element
- func Empty() *Element
- func Fieldset(attrs Attrs, children ...templ.Component) *Element
- func Form(attrs Attrs, children ...templ.Component) *Element
- func Fragment(children ...templ.Component) *Element
- func H1(attrs Attrs, children ...templ.Component) *Element
- func H2(attrs Attrs, children ...templ.Component) *Element
- func H3(attrs Attrs, children ...templ.Component) *Element
- func H4(attrs Attrs, children ...templ.Component) *Element
- func H5(attrs Attrs, children ...templ.Component) *Element
- func HR(attrs Attrs) *Element
- func Head(attrs Attrs, children ...templ.Component) *Element
- func Header(attrs Attrs, children ...templ.Component) *Element
- func Html(attrs Attrs, children ...templ.Component) *Element
- func I(attrs Attrs, children ...templ.Component) *Element
- func Img(attrs Attrs) *Element
- func Input(attrs Attrs) *Element
- func LI(attrs Attrs, children ...templ.Component) *Element
- func Label(attrs Attrs, children ...templ.Component) *Element
- func Legend(attrs Attrs, children ...templ.Component) *Element
- func Link(attrs Attrs) *Element
- func Main(attrs Attrs, children ...templ.Component) *Element
- func Meta(attrs Attrs) *Element
- func Nav(attrs Attrs, children ...templ.Component) *Element
- func New(tag string, attrs Attrs, children ...templ.Component) *Element
- func OL(attrs Attrs, children ...templ.Component) *Element
- func Optgroup(attrs Attrs, children ...templ.Component) *Element
- func Option(attrs Attrs, children ...templ.Component) *Element
- func P(attrs Attrs, children ...templ.Component) *Element
- func Raw(html string) *Element
- func Section(attrs Attrs, children ...templ.Component) *Element
- func Select(attrs Attrs, children ...templ.Component) *Element
- func Small(attrs Attrs, children ...templ.Component) *Element
- func Span(attrs Attrs, children ...templ.Component) *Element
- func Strong(attrs Attrs, children ...templ.Component) *Element
- func Summary(attrs Attrs, children ...templ.Component) *Element
- func TBody(attrs Attrs, children ...templ.Component) *Element
- func TD(attrs Attrs, children ...templ.Component) *Element
- func TFoot(attrs Attrs, children ...templ.Component) *Element
- func TH(attrs Attrs, children ...templ.Component) *Element
- func THead(attrs Attrs, children ...templ.Component) *Element
- func TR(attrs Attrs, children ...templ.Component) *Element
- func Table(attrs Attrs, children ...templ.Component) *Element
- func Text(text string) *Element
- func Textarea(attrs Attrs, children ...templ.Component) *Element
- func Title(attrs Attrs, children ...templ.Component) *Element
- func UL(attrs Attrs, children ...templ.Component) *Element
Constants ¶
This section is empty.
Variables ¶
var ( // VoidElements is a list of HTML void elements, these don't have children or content. VoidElements = map[string]string{ "area": ">", "base": ">", "br": ">", "col": ">", "embed": ">", "hr": ">", "img": ">", "input": ">", "link": ">", "meta": ">", "source": ">", "track": ">", "wbr": ">", } // NA is an empty set of attributes. NA = Attrs{} )
Functions ¶
func If ¶ added in v0.0.4
If returns the element if the condition is true, otherwise returns an empty element.
func IfElse ¶ added in v0.0.4
IfElse returns the truthy element if the condition is true, otherwise returns the falsy element.
func Map ¶ added in v0.0.4
Map function that applies a transformation function to a list of items and returns the resulting elements.
Types ¶
type Attrs ¶
type Attrs templ.Attributes
Attrs is a map of attributes for the element, currently uses templ.Attributes.
type ContentType ¶
type ContentType int
ContentType represents the type of content in an element.
const ( // TextContent represents text content to be escaped. TextContent ContentType = iota // RawContent represents raw HTML content with no escaping. RawContent )
type Element ¶
type Element struct {
Attrs Attrs `json:"attrs"`
Children []templ.Component `json:"children"`
Tag string `json:"tag"`
Content string `json:"content"`
ContentType ContentType `json:"content_type"`
}
Element represents an HTML element.
func Blockquote ¶
Blockquote creates a blockquote element <blockquote></blockquote>.
func Fragment ¶ added in v0.0.4
Fragment allows you to create a fragment of elements without a parent element.
func Raw ¶
Raw creates an element with raw HTML content. Warning: this elements cannot have children and content is not escaped.
func Text ¶
Text creates an element with text content. Warning: this elements cannot have children and content will be escaped.
func (*Element) AddChildren ¶
AddChildren adds children *Element's to this element.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
gtml
command
|
|
|
examples
|
|
|
conditional
command
|
|
|
custom
command
|
|
|
form
command
|
|
|
page
command
|
|
|
paginate
command
|
|
|
static
command
|
|
|
table
command
|
|
|
templ-attr-class
command
|
|
|
templ-attr-kv
command
|
|
|
templ-component
command
|
|
|
templ-js
command
templ: version: v0.3.819
|
templ: version: v0.3.819 |