ElNode class

HTML element descriptor.

Represents an HTML or custom element in the Bloom descriptor tree.

DOM Mounting and SSR

  • Browser (mount): Creates a web.Element matching tag via web.document.createElement(tag). Applies className, style, attrs, registers event listeners from on, creates an optional text child node if text is non-null, and recursively mounts children.
  • SSR (renderToHtml): Emits <tag [class] [style] [attrs]>...children</tag> with all attributes and text contents HTML-escaped. If tag is a standard HTML void element (e.g. img, input, br, hr), it is emitted without a closing tag and any children are omitted.

Most HTML elements have dedicated sugar subclasses such as Div, Span, Button, Input, Form, and A. Use ElNode or El directly when creating custom elements or tags without a dedicated sugar class.

Inheritance

Constructors

ElNode(String tag, {String? text, String? className, String? style, Map<String, String>? attrs, Map<String, BloomEventHandler>? on, List<BloomNode> children = const []})
Creates an element descriptor with tag and optional styling, attributes, event handlers, and child descriptors.
const

Properties

attrs Map<String, String>?
Arbitrary HTML attributes (id, href, placeholder, etc.).
final
children List<BloomNode>
Child descriptors nested within this element.
final
className String?
CSS class attribute applied to the element.
final
hashCode int
The hash code for this object.
no setterinherited
on Map<String, BloomEventHandler>?
Event handlers keyed by DOM event name (click, input, change...).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
style String?
Inline style — raw CSS string (e.g. "color: red; display: flex;").
final
tag String
Lowercase tag name, e.g. "div", "button", "custom-tag".
final
text String?
Optional single text child sugar — equivalent to children: [Text(text)] when no explicit children are given.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited