# Generative UI Spec
URL: /docs/api-reference/generative-ui/spec

The serializable node tree an assistant emits to describe generative UI. Covers the GenerativeUISpec format, its nodes, and the message part that carries the spec.

- as

  h2

API Reference

- as

  h3

GenerativeUIMessagePart

A message part that carries a JSON spec describing UI to render.

Render with `<MessagePrimitive.GenerativeUI components={...} />`. The primitive resolves component names against the consumer-provided allowlist — any unknown name throws a typed error rather than rendering. Stream- friendly: a partially-streamed spec renders progressively.

`GenerativeUIMessagePart`

- `type` `: "generative-ui"`

- `spec` `: GenerativeUISpec`

  The JSON spec describing the UI tree.

  - `root` `: GenerativeUINode | readonly GenerativeUINode[]`

    Root node(s) to render.

- `id` `?: string`

  Optional id (useful for replays / stable keys).

- `parentId` `?: string`

* as

  h3

GenerativeUINode

A JSON spec describing a tree of UI components to render.

The agent emits a

- href

  /docs/api-reference/generative-ui/spec#generativeuimessagepart

GenerativeUIMessagePart

containing this spec, and the consumer-provided component allowlist is used to resolve `component` names. Any component referenced that is not present in the allowlist is rejected with a typed error — the allowlist is the security boundary in the default same-realm rendering path.

`GenerativeUINode`

- `toString` `: (() => string) | (() => string)`
- `valueOf` `: (() => string) | (() => Object)`

* as

  h3

GenerativeUISpec

The root spec for a generative UI tree.

`GenerativeUISpec`

- `root` `: GenerativeUINode | readonly GenerativeUINode[]`

  Root node(s) to render.