MCPcopy
hub / github.com/wavetermdev/waveterm / H

Function H

tsunami/vdom/vdom.go:91–100  ·  view source on GitHub ↗

H creates a VDomElem with the specified tag, properties, and children. This is the primary function for creating virtual DOM elements. Children can be strings, VDomElems, *VDomElem, slices, booleans, numeric types, or other types which are converted to strings using fmt.Sprint. nil children are allo

(tag string, props map[string]any, children ...any)

Source from the content-addressed store, hash-verified

89// or other types which are converted to strings using fmt.Sprint.
90// nil children are allowed and removed from the final list.
91func H(tag string, props map[string]any, children ...any) *VDomElem {
92 rtn := &VDomElem{Tag: tag, Props: props}
93 if len(children) > 0 {
94 for _, part := range children {
95 elems := ToElems(part)
96 rtn.Children = append(rtn.Children, elems...)
97 }
98 }
99 return rtn
100}
101
102// If returns the provided part if the condition is true, otherwise returns nil.
103// This is useful for conditional rendering in VDOM children lists, props, and style attributes.

Callers 15

renderErrorComponentFunction · 0.92
makeClientFunction · 0.92
DefineComponentExFunction · 0.92
defaultCellRendererFunction · 0.92
defaultHeaderRendererFunction · 0.92
genTableRenderFuncFunction · 0.92
renderPaginationFunction · 0.92
app.goFile · 0.92
app.goFile · 0.92
app.goFile · 0.92
app.goFile · 0.92
app.goFile · 0.92

Calls 1

ToElemsFunction · 0.85

Tested by 2

TestHFunction · 0.56
TestJsonHFunction · 0.56