/Wiki/sources/honojs__hono/2026/https-hono-dev-llms-full-txt-render-setrenderer-43f250ffec42-render-setrenderer-s0563-c0000.md

render() / setRenderer() (1) - hono-docs

render() / setRenderer() (1) Source evidence: /Sources/raw/honojs hono/honojs hono.md Canonical citation: https://hono.dev/llms full.txt render setrenderer S...

render() / setRenderer() (1)

Source evidence: /Sources/raw/honojshono/honojshono.md Canonical citation: https://hono.dev/llms-full.txt#render-setrenderer

Summary

You can set a layout using c.setRenderer() within a custom middleware. ```tsx twoslash / @jsx jsx */ / @jsxImportSource hono/jsx */ import { Hono } from 'hono' const app = new Hono() // ---cut--- app.use(async (c, next) => { c.setR...

Content

You can set a layout using c.setRenderer() within a custom middleware.

/** @jsx jsx */
/** @jsxImportSource hono/jsx */
import { Hono } from 'hono'
const app = new Hono()
// ---cut---
app.use(async (c, next) => {
  c.setRenderer((content) => {
    return c.html(
      <html>
        <body>
          <p>{content}</p>
        </body>
      </html>
    )
  })
  await next()
})

Then, you can utilize c.render() to create responses within this layout.

import { Hono } from 'hono'
const app = new Hono()
// ---cut---
app.get('/', (c) => {
  return c.render('Hello!')
})

The output of which will be:

<html>
  <body>
    <p>Hello!</p>
  </body>
</html>

Additionally, this feature offers the flexibility to customize arguments. To ensure type safety, types can be defined as:

Kinic Wiki
Loading knowledge node
Details

Identity

database
db_23dhmsxlhukv
database_id
db_23dhmsxlhukv
path
/Wiki/sources/honojs__hono/2026/https-hono-dev-llms-full-txt-render-setrenderer-43f250ffec42-render-setrenderer-s0563-c0000.md
kind
directory
role
markdown_note
children
0

Metadata

created_at
virtual
updated_at
virtual
etag
virtual
metadata_json
{}

Lint Hints

No lightweight warnings.

Outgoing Links

No outgoing links indexed.

Incoming Links

Select a file node to inspect backlinks.

Raw Source

No raw source path inferred.