caliper uidocs

Generative renderer

Pro

Render 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.

Installs components/ui/generative-renderer.tsxDepends on @radix-ui/react-slot, lucide-reactMotion none in component source
pnpm dlx shadcn@latest add @caliper/generative-renderer

Answer from Halden Assistant

October refunds

Refunded€4,212−18% vs Sep
Requests37
Median time6h+2h
Largest refunds
CustomerReasonAmount
NorthwindDuplicate charge144
Lumen LabsDowngrade96
QuaysideService outage72

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 #

terminal
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.

example.tsx
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.

Checking your licence…

API reference #

validateUiSpec

component

No props of its own; it re-exports a primitive and takes that primitive’s props.

GenerativeRenderer

component
PropTypeDefaultDescription
spec *unknown—
registryUiRegistrydefaultUiRegistry
actionsreadonly string[]—Action names a button may send. Others are reported and ignored.
onAction((action: string, payload?: unknown) => void)—
labelstring"Generated view"
classNamestring—

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.