header

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package header provides constructors and methods for the HTML <header> element.

The <header> HTML element represents introductory content, typically a group of introductory or navigational aids. It may contain some heading elements but also a logo, a search form, an author name, and other elements.

Index

Constants

This section is empty.

Variables

View Source
var (
	TagOpen  = []byte("<header")
	TagClose = []byte("</header>")
)

Byte constants for HTML rendering.

Functions

func New

func New(nodes ...node.Node) *element

New creates a new header element with the given child nodes. Example: header.New(h1.Text("Welcome"), p.Text("A brief introduction")) Renders: <header><h1>Welcome</h1><p>A brief introduction</p></header>

func RawText added in v0.3.0

func RawText(content string) *element

RawText creates a new header element with raw text content. Uses text.RawText which is not HTML-escaped. Example: header.RawText("<h1>Welcome</h1>") Renders: <header><h1>Welcome</h1></header>

func RawTextf added in v0.3.0

func RawTextf(format string, args ...any) *element

RawTextf creates a new header element with formatted raw text content. Uses text.RawTextf which is not HTML-escaped. Example: header.RawTextf("<h1>%s</h1>", title) Renders: <header><h1>Dashboard</h1></header>

func Static added in v0.3.0

func Static(content string) *element

Static creates a new header element with static text content. Uses text.Static which is not HTML-escaped and is JIT-optimisable. Example: header.Static("Welcome") Renders: <header>Welcome</header>

func Text added in v0.3.0

func Text(content string) *element

Text creates a new header element with text content. Uses text.Text which HTML-escapes the output. Example: header.Text("Welcome") Renders: <header>Welcome</header>

func Textf added in v0.3.0

func Textf(format string, args ...any) *element

Textf creates a new header element with formatted text content. Uses text.Textf which HTML-escapes the output. Example: header.Textf("Welcome, %s", name) Renders: <header>Welcome, Mary</header>

Types

type Element

type Element = element

Element is an exported alias for the private element type

Jump to

Keyboard shortcuts

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