Generative renderer
ProRender a UI an assistant described as JSON through a registry you control: no HTML or scripts, unknown parts replaced by a marked placeholder while the rest renders, the spec and its problems one click away, and only allowed actions sent.
pnpm dlx shadcn@latest add @caliper/generative-rendererAnswer from Halden Assistant
October refunds
| Customer | Reason | Amount |
|---|---|---|
| Northwind | Duplicate charge | 144 |
| Lumen Labs | Downgrade | 96 |
| Quayside | Service outage | 72 |
When to use #
Use it for
- Assistants that answer with tables, metrics or actions instead of prose.
- Agent output that needs to be safe to render.
Skip it when
- Fixed screens you design yourself; build them directly.
Installation #
pnpm dlx shadcn@latest add @caliper/generative-renderer
Adds its 6 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.
Usage #
Import it from your copy of the source. The example behind the preview comes with the source. It is built from validateUiSpec and GenerativeRenderer.
import { validateUiSpec, GenerativeRenderer, defaultUiRegistry } from "@/components/ui/generative-renderer"
The worked example comes with Pro
The 45-line example behind the preview opens here with a Pro or Team licence.
API reference #
validateUiSpec
component
No props of its own; it re-exports a primitive and takes that primitive’s props.
GenerativeRenderer
component
defaultUiRegistry
helper
A helper exported alongside the component, not a component.
Accessibility #
It exposes region and alert semantics, with aria-label, aria-hidden, aria-labelledby and aria-pressed kept in step with state. Changes that matter are announced through a live region.
No custom key handling; Tab and the native activation keys do the work.
Motion #
It declares no animation in its component source. Any transition comes from its stylesheet, which uses the duration tokens that collapse to instant under prefers-reduced-motion.