Text
Text renders plain copy in a semantic tag.
github.com/fastygo/templ/ui
Summary
Text renders plain copy in a semantic tag.Pass copy as the second value argument.
Use Cases
Render body paragraph copy
Render muted helper line with Tag small
Semantics
ResolveTag uses TagGroupText from utils
Invalid Tag falls back to p
Example tag.p
Body paragraph text.
import "github.com/fastygo/templ/ui"
templ Example() {
@ui.Text(ui.TextProps{}, "Body paragraph text.")
}
import "github.com/fastygo/templ/ui"
templ Example() {
@ui.Text(ui.TextProps{}, "Body paragraph text.")
}
Example tag.small
Helper line.
import "github.com/fastygo/templ/ui"
templ Example() {
@ui.Text(ui.TextProps{Tag: "small", Class: "text-muted-foreground"}, "Helper line.")
}
import "github.com/fastygo/templ/ui"
templ Example() {
@ui.Text(ui.TextProps{Tag: "small", Class: "text-muted-foreground"}, "Helper line.")
}
Example tag.code
npm installimport "github.com/fastygo/templ/ui"
templ Example() {
@ui.Text(ui.TextProps{Tag: "code", Class: "text-sm"}, "npm install")
}
import "github.com/fastygo/templ/ui"
templ Example() {
@ui.Text(ui.TextProps{Tag: "code", Class: "text-sm"}, "npm install")
}
API
Attrs · templ.Attributes — role: html-attrs
Class · string — role: style-extension
Tag · string — role: prose-tag; enum: p|blockquote|figcaption|address|pre|span|em|strong|small|abbr|cite|code|kbd|mark|time|data|var|samp|sub|sup|b|i|u|s|q|dfn|bdo|bdi|ins|del; default: p; source: utils.tags.TagGroupText
value · string — role: copy