Title
Title renders one heading from Order prop.
github.com/fastygo/templ/ui
Summary
Title renders one heading from Order prop.TitleTag maps Order to h1 through h6.
Use Cases
Render page title with Order 1
Render section title with Order 2
Semantics
Order 0 and 2 default to h2
Order 1 maps to h1, Order 3 to h3
Example order.h1
Page title
import "github.com/fastygo/templ/ui"
templ Example() {
@ui.Title(ui.TitleProps{Order: 1}, "Page title")
}
import "github.com/fastygo/templ/ui"
templ Example() {
@ui.Title(ui.TitleProps{Order: 1}, "Page title")
}
Example order.h2
Section title
import "github.com/fastygo/templ/ui"
templ Example() {
@ui.Title(ui.TitleProps{Order: 2}, "Section title")
}
import "github.com/fastygo/templ/ui"
templ Example() {
@ui.Title(ui.TitleProps{Order: 2}, "Section title")
}
Example order.h3
Subsection title
import "github.com/fastygo/templ/ui"
templ Example() {
@ui.Title(ui.TitleProps{Order: 3, Class: "text-lg"}, "Subsection title")
}
import "github.com/fastygo/templ/ui"
templ Example() {
@ui.Title(ui.TitleProps{Order: 3, Class: "text-lg"}, "Subsection title")
}
API
Class · string — role: style-extension
Order · int — role: heading-level; source: utils.helpers.TitleTag
value · string — role: copy