Message
A single message in a conversation. Messages may consist of multiple parts.
Anatomy
API Reference
Root
Containts all parts of the message.
This primitive renders a <div>
element unless asChild
is set.
MessagePrimitiveRootProps
asChild:
Change the default rendered element for the one passed as a child, merging their props and behavior.
Read the Composition guide for more details.
Content
The content of the message. This renders a separate component for each content part of the message.
MessagePrimitiveContentProps
components?:
The components to render for each content part.
ContentPartComponents
Text?:
The component to render for each text content part.
Image?:
The component to render for each image content part.
Audio?:
The component to render for each audio content part.
UI?:
The component to render for each UI content part.
tools?:
The component to render for each tool call content part.
by_name?:
The components to render for each tool call content part.
Fallback?:
The fallback component to render for tool call content parts.
If
Renders children if a condition is met.
UseMessageIfProps
user?:
Render children if the message is from the user.
assistant?:
Render children if the message is from the assistant.
hasBranches?:
Render children if the message has branches.
copied?:
Render children if the message is copied.
lastOrHover?:
Render children if the message is the last or hovered over.