Documentation
¶
Overview ¶
Package datalist provides constructors and methods for the HTML <datalist> element.
The <datalist> HTML element provides a list of predefined options for input elements, creating an autocomplete dropdown that suggests values while allowing custom input. Associated with input elements via the list attribute. Useful for offering common choices while maintaining input flexibility, such as country names, product categories, or frequent search terms.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( TagOpen = []byte("<datalist") TagClose = []byte("</datalist>") )
Byte constants for HTML rendering.
Functions ¶
func New ¶
New creates a new datalist element with child nodes (typically <option> elements). Example: datalist.New(option.New().Value("Chocolate"), option.New().Value("Vanilla")) Renders: <datalist><option value="Chocolate"><option value="Vanilla"></datalist>
func Options ¶ added in v0.3.0
Options creates a datalist from option elements, enforcing correct nesting at compile time. Example: datalist.Options(option.Option("chocolate", "Chocolate"), option.Option("vanilla", "Vanilla")) Renders: <datalist><option value="chocolate">Chocolate</option><option value="vanilla">Vanilla</option></datalist>