datalist

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: 22 Imported by: 0

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

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

Byte constants for HTML rendering.

Functions

func New

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

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

func Options(options ...*option.Element) *element

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>

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