HtmlRenderer
Lower-level rendering utility behind Live HTML. Most applications should use page(), start(), defineSite(), and exportStatic(); this surface supports advanced integrations and tooling.
The simple mental model
HtmlRenderer is the machinery under the hood that turns a page object and its declared bindings into final markup.
When should I use it?
Use it for tooling or advanced integrations that genuinely need lower-level rendering control; normal applications should prefer pages, start, defineSite, or exportStatic.
Follow the example
This pattern explains the named API. Application classes, credentials, and assets may need to be supplied; use a complete recipe for a runnable starting point.
import { HtmlRenderer } from 'redweb'
const markup = HtmlRenderer.render(
'<h1>{{ title }}</h1>',
{ title: 'Reference' },
{ live: false },
)
const document = HtmlRenderer.document(markup, null, [], {
title: 'Reference',
})- 1
A source template or fragment and page instance enter the renderer.
- 2
Declared state, actions, views, and safe values are resolved under the render options.
- 3
The caller receives final HTML suitable for its own response or build pipeline.
Methods and members
render(source, page, options?)
Renders declarative bindings and collection views against a page object.
document(markup, config?, stylesheets?, metadata?)
Wraps markup in a complete document and injects metadata, CSS, and optional live bootstrap.
template() / stylesheet()
Loads a validated page asset inside an explicit root.
statePayload()
Builds the text or trusted-HTML state payload used by live updates.