How-to guides¶
Short, focused recipes. Each guide solves one problem and assumes you already know the basics — start with the Tutorials if you don’t.
- Assemble a page in parts
- Stream HTML to a socket
- Stream HTML asynchronously
- Convert a CSV to an HTML table
- Embed binary data with a
data:URI - Lazy children with callables
- Conditional attributes with
ABSENT - Boolean attributes
- Custom tags
- Fragments vs Raw
- Inline and embedded CSS
- Unescaped content in
<script>and<style> - Pre-resolve async data
- Serve HTML fragments to htmx
Recipe index¶
Building pages¶
Assemble a page in parts — share references to nodes and fill them in later.
Custom tags — emit non-standard tag names without subclassing.
Fragments vs Raw — group children with no wrapper, or embed pre-rendered HTML safely.
Attributes¶
Dynamic content¶
I/O & streaming¶
Stream HTML asynchronously — with
tagz.aio, for handlers that await DB/HTTP inline.
Frameworks¶
Serve HTML fragments to htmx — minimal aiohttp + htmx demo; a fuller version lives in
examples/htmx-asyncio.