type alias ViewPluginOptions
Since 0.6.0

Selects the view engine the plugin registers under CAPABILITIES.VIEW.

  • 'hono-jsx' (default): components are JSX functions authored with @hono/hono/jsx; the application's manifest declares the jsx / jsxImportSource compiler options.
  • 'hono-html': components are functions returning an html tagged template result; needs no jsxImportSource, so it works in a plain .ts file.
  • 'custom': requires ViewPluginCustom.view; the supplied engine is registered verbatim — this is how a by-name engine (Handlebars, Eta) participates: it adapts each compiled template to a (props) => string function, which is already a Component<P>.

There is deliberately no plugin-level layout option: such an option would wrap EVERY render — including the fragments and partial responses IResponse.html already serves to HTMX-style callers, where a full document is the wrong answer — and a page wanting no layout would then need an opt-out. Compose explicitly instead: wrap the child component in the layout at the call site.

Definition

{ readonly engine?: "hono-jsx"; }
| { readonly engine: "hono-html"; }
| { readonly engine: "custom"; readonly view: IViewEngine; }

Usage

import { type ViewPluginOptions } from "view-plugin/src/index.ts";