Skip to content

Renderer

The Renderer widget renders raw framework markup returned by a callback. Use it when you need to drop a small piece of bespoke UI inside a form — a heading, a summary block, a chart — without writing a full custom widget.

import { gui } from '@golemui/gui-shared';
import { html } from 'lit';
const formDef = [
gui.displays.display(
(params) => html`<h2>Hello, ${params?.$form?.name ?? 'guest'}!</h2>`,
),
];

The Renderer widget takes a function as its only argument. There’s no JSON equivalent — JSON cannot serialize functions.

import { gui } from '@golemui/gui-shared';
import * as React from 'react';
const formDef = [
gui.displays.display(
(params) => (
<div className="summary">
<h2>Booking summary</h2>
<p>Customer: {params?.$form?.customer?.name}</p>
</div>
),
),
];

The callback receives a params object with $form (the live form data tree) and re-renders whenever any referenced path changes. Read what you need from $form and the widget will keep itself in sync.