Quickstart
Installation
Package is on pypi. Use uv, poetry or pip to install
The Basics
All html tags can be imported directly like:
Tags are nested by adding children in the constructor:
Add text to your tag:
use .dump() to dump your Elements to html.
outputs
Composability with slots
from hypermedia import Html, Body, Div, Menu, Header, Div, Ul, Li
base = Html(
Body(
Menu(slot="menu"),
Header("my header", slot="header"),
Div(slot="content"),
),
)
menu = Ul(Li(text="main"))
content = Div(text="Some content")
base.extend("menu", menu)
base.extend("content", content)
base.dump()
output