Element node

Purpose

Element is a safe generic HTML Node. Use it for static structural HTML in the first Core renderer.

Inputs

Field Required Type Behavior
tag yes HTML tag name Complete allowlist: div, span, section, article, header, footer, main, nav, p, ul, ol, li, table, thead, tbody, tr, th, and td; unsupported tags fail validation.
children yes Node list Rendered in order.
attrs no Props map String, boolean, and number values only. Allowed keys are id, class, title, role, data-*, and aria-*; event-handler attributes, URL-bearing attributes, and raw style strings are rejected.

Boundary

Output uses the requested safe tag and stable attributes.

Go Shape

import "github.com/busdk/bus-gx/pkg/gx"

node := gx.Element("section",
	gx.Props{"class": "bus-panel"},
	gx.Text("Generic content"),
)

The rendered output is:

<section class="bus-panel">Generic content</section>

Generic Element does not create links because a is outside its tag allowlist.