Skip to content
Agent UI
BlocksOpenUIMessage

OpenUIMessage

Optional official OpenUI renderer host for structured responses. Import from @agent-ui/react or a direct subpath. Tailwind CSS v4 theme tokens are required.

OpenUIMessage ships with a full API table, a copyable example, and accessibility notes.

tsx

Renderer adapter preview

A structured UI response would appear here.

Connect the official OpenUI Renderer to render real OpenUI Lang.

Installation

Install the package once, then import OpenUIMessage from its direct entry point or from the root.

bash
pnpm add @agent-ui/react
tsx
import { OpenUIMessage } from "@agent-ui/react/openui-message";

Tailwind CSS v4 users: add @source "../node_modules/@agent-ui/react/src" to the global stylesheet so the library utilities are generated.

Usage

The example below is the same code that renders the preview. Copy it, swap in your own handlers, and ship.

tsx
import { OpenUIMessage } from "@agent-ui/react";
 
<OpenUIMessage renderer={Renderer} library={library} response={message} />

API reference

Every prop OpenUIMessage accepts, its type, default, and behaviour.

API reference for this component
NameTypeDefaultDescription
rendererReact.ComponentType<OpenUIRendererProps>—Official OpenUI Renderer component.
libraryLibrary—Component library created by OpenUI.
responsestring | null—Model's OpenUI Lang response.
isStreamingboolean—Configuration exposed through the component's public React props.
onActioncallback—Configuration exposed through the component's public React props.

Accessibility

Provide explicit action authorization and accessible labels when composing the block.
Use it with the rest of the library

OpenUIMessage composes with MessageList, ChatShell, useChat, and the provider compose blocks. Browse the full reference or see all components in the gallery.

3 lines · copy-ready