optgroup

package
v0.3.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

	AttrLabel    = []byte(" label=\"")
	AttrDisabled = []byte(" disabled")
)

Byte constants for HTML rendering.

Functions

func Labelled added in v0.3.0

func Labelled(label string, nodes ...node.Node) *element

Labelled Creates an optgroup with a label and child option elements. The label is displayed as a heading above the grouped options in the browser's dropdown. This is the most common pattern since the label attribute is essential for usability. Example: optgroup.Labelled("Colours", option.Option("red", "Red"), option.Option("blue", "Blue")) Renders: <optgroup label="Colours"><option value="red">Red</option><option value="blue">Blue</option></optgroup>

func New

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

New Creates a new optgroup element with child option elements. Example: optgroup.New(option.Option("red", "Red"), option.Option("blue", "Blue")).Label("Colours") Renders: <optgroup label="Colours"><option value="red">Red</option><option value="blue">Blue</option></optgroup>

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