Context
Per-request render context. Owns the arena; provides element factories, head helpers, and request data. Guide: Rendering.
Request data
| Member | Signature | Notes |
|---|---|---|
param | (name: []const u8) ?[]const u8 | captured :name path segment |
location | ?*Location | path, query, fragment |
request_meta | ?*const RequestMeta | cookies, headers, UA |
alloc | () std.mem.Allocator | request arena |
io | ?std.Io | process IO handle (server-populated) |
csrf_token / csp_nonce | []const u8 | populated by the server |
Render helpers
| Member | Signature |
|---|---|
assetHref | (path) ![]const u8 — hashed /public URL |
activeClass | (href, active_class) []const u8 |
outlet | () *Node — nested-route child placeholder |
redirect | (to) *Node — 303; redirectWithStatus(to, status) |
errorBoundary | (inner, fallback) *Node |
serverFn | (comptime f, args) ReturnOf(f) — direct call, no HTTP |
fetch | (url, FetchOptions) !FetchResponse — server only |
Head
setTitle(t) · setTitleIfUnset(t) · metaTag(Meta) · linkTag(Link) · jsonLd(json) — all !void, push into the per-request accumulator the shell drains.
Reactivity & DI
useSignal(T, initial) !*Signal(T) · useEffect(ctx_ptr, f) !*Effect · nodeRef(tag, id) · provide(T, value) / use(T) / usePtr(T).
Element factories
Dedicated: div span p h1 h2 h3 h4 a button input form ul ol li img br
hr label code pre nav main_ section header footer article aside strong
em small textarea select option link meta title style script.
Special:
| Factory | Produces |
|---|---|
el(tag) | any element |
raw(bytes) | verbatim fragment (pair with .contentType(...)) |
textNode(t) | bare escaped text |
template(name, inner) | <template data-vt> for client cloning |
scriptInline(body) | nonce'd inline script (unescaped!) |
codeBlock(source, lang) | highlighted <pre><code> |
markdown(src) / markdownOpts(src, opts) | GFM subtree |
actionForm(FormOpts) | form + hidden CSRF field |
csrfField() | the hidden input alone |
glScene(GlSceneOpts) | WebGL scene builder |
islandState(fields) / islandStateStruct(key, value) | state blobs |