Generative UI

Generative UI Rendering

Render a generative UI spec into React. The renderer resolves spec nodes against your component registry, and the error thrown when a component cannot be resolved.

API Reference

GenerativeUIRender

Internal renderer. Resolves a GenerativeUISpec against the consumer allowlist. Used by MessagePrimitive.GenerativeUI and by MessagePrimitive.Parts when handling a generative-ui part.

GenerativeUIRender props
spec : GenerativeUISpec

The JSON spec to render.

root : GenerativeUINode | readonly GenerativeUINode[]

Root node(s) to render.

components : GenerativeUIComponentRegistry

The component allowlist.

Fallback ?: ComponentType<{ component: string; props?: unknown }>

Optional fallback for unknown component names.

GenerativeUIRenderError

Thrown when a generative-ui spec references a component name that is not present in the consumer-provided allowlist. The allowlist is the security boundary in the same-realm rendering path — there is no fallback by default. Pass Fallback to opt into a soft-fail UX.

GenerativeUIRenderError
constructor ?: (componentName: string, message: string = `Component "${componentName}" is not in the generative-ui allowlist.`) => GenerativeUIRenderError

componentName ?: string