h()
The hypertext function creates a virtual node representing a DOM element. Itβs the core function for building UIs in GlyphUI.Signature
Parameters
The HTML tag name of the element (e.g., βdivβ, βspanβ, βbuttonβ)
Properties to add to the element as attributes. Supports special props:
class: A string or array of strings for the elementβs class liststyle: An object containing CSS propertieson: An object containing event listeners (e.g.,{ click: handleClick })key: A unique identifier for efficient list rendering (not rendered as an attribute)
Child nodes to add to the element. Strings are automatically converted to text nodes using
hString().Return Value
Returns a virtual node object with the following structure:
Examples
Basic Element
Element with Event Listeners
Element with Styles
Nested Elements
DOM Types
GlyphUI defines the following DOM types:Related Functions
hString()
Creates a text virtual node. Signature:str(string): The text content
hFragment()
Wraps virtual nodes in a fragment (similar to React.Fragment). Useful for returning multiple root elements. Signature:vNodes(array): Array of virtual nodes to wrap. Strings are automatically converted to text nodes.
Notes
- Children that are
nullorundefinedare automatically filtered out - String children are automatically converted to text nodes using
hString() - The
keyprop is used internally for efficient list rendering and is not added as a DOM attribute