# MessagePrimitive URL: /docs/api-reference/primitives/Message Components for rendering message content, parts, and attachments. *** title: MessagePrimitive description: Components for rendering message content, parts, and attachments. ------------------------------------------------------------------------------ A single message in a conversation. Messages may consist of multiple parts. import { ParametersTable } from "@/components/docs/tables/ParametersTable"; ## Anatomy ```tsx import { MessagePrimitive } from "@assistant-ui/react"; const UserMessage = () => ( User: ); const AssistantMessage = () => ( Assistant: ); ``` ## API Reference ### Root Containts all parts of the message. This primitive renders a `
` element unless `asChild` is set. ### Parts The content of the message. This renders a separate component for each content part of the message. ", description: "The components to render for each tool call content part.", }, { name: "Fallback", type: "ToolCallContentPartComponent", description: "The fallback component to render for tool call content parts.", }, ], }, ], }, { name: "ToolGroup", type: "ComponentType>", description: "Component for rendering grouped consecutive tool calls. When provided, consecutive tool-call content parts will be automatically grouped and wrapped with this component.", children: [ { type: "ToolGroupProps", parameters: [ { name: "startIndex", type: "number", description: "Index of the first tool call in the group.", required: true, }, { name: "endIndex", type: "number", description: "Index of the last tool call in the group.", required: true, }, { name: "children", type: "ReactNode", description: "The rendered tool call components within the group.", required: true, }, ], }, ], }, ], }, ], }, ]} /> ### PartByIndex Renders a single message part at the specified index. ```tsx ``` ### Attachments Renders all attachments of the message. ### AttachmentByIndex Renders a single attachment at the specified index within the message. ```tsx ``` ### Error Renders children only if the message has an error status. ```tsx {/* rendered if the message has an error status */} ```