fieldset

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 fieldset provides constructors and methods for the HTML <fieldset> element.

The <fieldset> HTML element groups related form controls and labels, providing semantic structure and visual organisation to forms. Often paired with a <legend> element to provide a caption. Useful for organising complex forms into logical sections, supporting accessibility by grouping related inputs, and enabling bulk enable/disable of controls via the disabled attribute.

Index

Constants

This section is empty.

Variables

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

	AttrDisabled = []byte(" disabled")
	AttrForm     = []byte(" form=\"")
	AttrName     = []byte(" name=\"")
)

Byte constants for HTML rendering.

Functions

func Disabled added in v0.3.0

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

Disabled creates a disabled fieldset where all descendant form controls are inactive. The legend element and its contents are exempt from disabling. Useful for sections of a form that are conditionally unavailable. Example: fieldset.Disabled(legend.Text("Premium features"), input.Text("code", "")) Renders: <fieldset disabled><legend>Premium features</legend><input name="code" type="text" /></fieldset>

func Legend added in v0.3.0

func Legend(caption string, nodes ...node.Node) *element

Legend creates a fieldset with a legend and form controls. The legend is rendered as the first child, labelling the group. Example: fieldset.Legend("Address", input.Text("street", "")) Renders: <fieldset><legend>Address</legend><input name="street" type="text" /></fieldset>

func New

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

New creates a new fieldset element with child nodes. Example: fieldset.New(legend.Text("Personal details"), input.Text("name", "")) Renders: <fieldset><legend>Personal details</legend><input name="name" type="text" /></fieldset>

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