Documentation
¶
Overview ¶
Package optgroup provides constructors and methods for the HTML <optgroup> element.
The <optgroup> HTML element creates a grouping of options within a <select> element.
Index ¶
Constants ¶
This section is empty.
Variables ¶
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
Labelled creates a labelled optgroup from option elements, enforcing correct nesting at compile time. 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 ¶
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>
func Options ¶ added in v0.3.0
Options creates an optgroup from option elements, enforcing correct nesting at compile time. Example: optgroup.Options(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>