html

js/ui/html.ts

fino:ui/html — render host-neutral Fino VNodes to HTML strings.

This module is the server-side serializer for fino:ui trees. It does not retain component state or reconcile trees; each call walks the supplied VNode and returns a complete HTML string. Use it for server-rendered pages, emails, and server-driven UI regions that will be patched into a browser later.

Design

Text and attribute values are escaped with fino:template's HTML escaping. Boolean attributes render only when true, className maps to class, style objects become CSS declarations, and function props throw because server HTML cannot preserve event handlers. rawHtml() is the explicit escape hatch for trusted markup.

/** @jsxImportSource fino:ui *\/
import { renderToHtml } from 'fino:ui/html';

const html = renderToHtml(<button disabled>Save</button>);

Interfaces

interface RawHtml {

Readonly Properties

readonly RAW_HTML]: string

Trusted markup payload consumed by renderToHtml().

The symbol key keeps this payload out of ordinary object enumeration.

Functions

function rawHtml(html: string): RawHtml

Mark a trusted string as raw HTML.

Raw HTML is inserted without escaping. Only pass strings produced by trusted code or an HTML sanitizer.

import { h } from 'fino:ui';
import { rawHtml, renderToHtml } from 'fino:ui/html';

const html = renderToHtml(h('div', null, rawHtml('<span>ok</span>')));

function renderToHtml(vnode: VNode | RawHtml): string

Render one Fino UI VNode to an HTML string.

The serializer accepts trees produced by h() or the JSX runtime. Fragments render their children without a wrapper. Void elements never receive closing tags.

Text and attribute values are escaped. Function-valued props throw because they cannot be represented in static HTML; use server-driven actions or a client runtime rather than embedding handlers.

import { h } from 'fino:ui';
import { renderToHtml } from 'fino:ui/html';

const html = renderToHtml(h('input', { name: 'q', value: 'a&b' }));