Message part primitives for rendering text, tool calls, data parts, reasoning, source content, and custom assistant output.
Anatomy
import { MessagePartPrimitive } from "@assistant-ui/react";
const TextMessagePart = () => {
return <MessagePartPrimitive.Text />;
};API Reference
Text
Renders the text content of a message part with optional smooth streaming. This component displays text content from the current message part context, with support for smooth streaming animation that shows text appearing character by character as it's generated.This primitive renders a <span> element unless asChild is set.
MessagePartPrimitiveTextPropsrender?: ReactElementsmooth: boolean= trueWhether to enable smooth text streaming animation. When enabled, text appears with a typing effect as it streams in.
component: ElementType= "span"The HTML element or React component to render as.
| Data attribute | Values |
|---|---|
[data-status] | "running", "complete", or "incomplete" |
Image
Renders an image from the current message part context. This component displays image content from the current message part, automatically setting the src attribute from the message part's image data.MessagePartPrimitiveImagePropsasChild: boolean= falseChange the default rendered element for the one passed as a child, merging their props and behavior.
Read the Composition guide for more details.render?: ReactElement
InProgress
Messages
MessagePartPrimitiveMessagesPropscomponents?: ThreadPrimitiveMessages.Props["components"]Message: ComponentTypeComponent used to render all message types
EditComposer?: ComponentTypeComponent used when editing any message type
UserEditComposer?: ComponentTypeComponent used when editing user messages specifically
AssistantEditComposer?: ComponentTypeComponent used when editing assistant messages specifically
SystemEditComposer?: ComponentTypeComponent used when editing system messages specifically
UserMessage?: ComponentTypeComponent used to render user messages specifically
AssistantMessage?: ComponentTypeComponent used to render assistant messages specifically
SystemMessage?: ComponentTypeComponent used to render system messages specifically
children?: (value: { message: ThreadMessage }) => ReactNodeRender function called for each message. Receives the message.