Documentation
¶
Overview ¶
templ: version: v0.3.1036
Package layout provides page-level layout components including base HTML shell, containers, and structural templates.
Package layout provides Sub-Resource Integrity hashes for HTMX CDN scripts.
templ: version: v0.3.1036
Index ¶
Constants ¶
const ( // DefaultThemeColor is the default light-mode theme color (indigo-600) DefaultThemeColor = "#4f46e5" // DefaultDarkThemeColor is the default dark-mode theme color (indigo-950) DefaultDarkThemeColor = "#1e1b4b" )
Variables ¶
This section is empty.
Functions ¶
func Base ¶
Base renders a complete HTML5 base layout with HTMX, theme support, and meta tags Use with children... to inject page content into the body
@layout.Base(props) {
<h1>My Page</h1>
}
func Minimal ¶
func Minimal(props MinimalProps) templ.Component
Minimal renders a minimal HTML5 document without HTMX or external dependencies Useful for static pages, emails, or PDF generation
@layout.Minimal(layout.MinimalProps{Title: "My Title"}) {
<h1>Hello</h1>
}
func ThemeScript ¶
ThemeScript renders the inline script that sets the dark mode class before paint Include this in your base template head to prevent FOUC
Types ¶
type MinimalProps ¶
MinimalProps configures a minimal HTML5 document without HTMX or external dependencies
func DefaultMinimalProps ¶
func DefaultMinimalProps() MinimalProps
DefaultMinimalProps returns sensible defaults for MinimalProps
type PageProps ¶
type PageProps struct {
Title string
Description string
Locale string
OGImage string
ThemeColor string
DarkThemeColor string
CSSPath string
Favicon string
HTMXVersion string
HTMXUseSRI bool
BodyClass string
Nonce string
HeadContent templ.Component
// SecurityHeaders controls whether security meta tags are included
SecurityHeaders bool
}
PageProps configures the base page layout
func DefaultPageProps ¶
func DefaultPageProps() PageProps
DefaultPageProps returns sensible defaults for PageProps