html
wybthon.html¶
Pythonic HTML element helpers that wrap the h() function.
Instead of writing::
h("div", {"class": "card", "on_click": handler}, h("p", {}, "Hello"))
you can write::
div(p("Hello"), class_name="card", on_click=handler)
Children are positional arguments, props are keyword arguments.
Prop name mapping:
class_name→class(Python reserved word)html_for→for(Python reserved word)- All other kwargs pass through unchanged.
Fragment(*args)
¶
Group multiple children without adding a visible wrapper to the DOM.
Uses a <span style="display:contents"> so the wrapper is invisible to
CSS layout while keeping the VDOM diffing algorithm simple.
Can be called directly::
Fragment(child1, child2)
Or used as a component tag via h()::
h(Fragment, {}, child1, child2)