Documentation
¶
Index ¶
- Variables
- func Group(name string, nodes ...node.Node) *element
- func New(nodes ...node.Node) *element
- func RawText(content string) *element
- func RawTextf(format string, args ...any) *element
- func Static(content string) *element
- func Summary(label string, nodes ...node.Node) *element
- func Text(content string) *element
- func Textf(format string, args ...any) *element
- type Element
Constants ¶
This section is empty.
Variables ¶
var ( TagOpen = []byte("<details") TagClose = []byte("</details>") AttrOpen = []byte(" open") AttrName = []byte(" name=\"") )
Byte constants for HTML rendering.
Functions ¶
func Group ¶ added in v0.3.0
Group Creates a details element in a named accordion group. Only one details element with the same name can be open at a time, providing native accordion behaviour without JavaScript. Example: details.Group("faq", summary.Text("Question 1"), p.Text("Answer 1")) Renders: <details name="faq"><summary>Question 1</summary><p>Answer 1</p></details>
func New ¶
New Creates a new details element with the given child nodes. Example: details.New(summary.Text("Details"), p.Text("Hidden content")) Renders: <details><summary>Details</summary><p>Hidden content</p></details>
func RawText ¶ added in v0.3.0
func RawText(content string) *element
RawText Creates a new details element with raw text content. Uses text.RawText which is not HTML-escaped. Example: details.RawText("<p>Disclosure content</p>") Renders: <details><p>Disclosure content</p></details>
func RawTextf ¶ added in v0.3.0
RawTextf Creates a new details element with formatted raw text content. Uses text.RawTextf which is not HTML-escaped. Example: details.RawTextf("<p>Section %d</p>", 1) Renders: <details><p>Section 1</p></details>
func Static ¶ added in v0.3.0
func Static(content string) *element
Static Creates a new details element with static text content. Uses text.Static which is not HTML-escaped and is JIT-optimisable. Example: details.Static("Disclosure content") Renders: <details>Disclosure content</details>
func Summary ¶ added in v0.3.0
Summary Creates a details element with a summary label and content. The summary is displayed as the clickable heading; the remaining nodes are revealed when the widget is opened. Example: details.Summary("More info", p.Text("Details here")) Renders: <details><summary>More info</summary><p>Details here</p></details>