Clarx

Chat Message

A single message in a conversation, supporting user, assistant, and system roles with streaming-aware rendering.

ChatMessage is the core building block of any conversational interface. It handles layout, avatar placement, role-based styling, optional timestamps, and a streaming cursor state. All three roles — user, assistant, and system — are supported out of the box.

U
Can you summarize this document for me?
AI
Sure! Here's a concise summary of the key points...
Conversation started

Streaming state

Set isStreaming={true} to append a blinking cursor to the message content. Use this while the model is mid-response.

AI
Analyzing the document structure and key themes

With timestamps

Pass a timestamp string to render a label beneath the bubble.

U
Can you summarize this document for me?
2:31 PM
AI
Sure! Here's a concise summary of the key points...
2:31 PM

Props

PropTypeDefaultDescription
role"user" | "assistant" | "system"Who sent the message
contentReact.ReactNodeMessage content
isStreamingbooleanfalseAppends an animated blinking cursor
avatarReact.ReactNodeCustom avatar element (defaults to "U" / "AI" circle)
timestampstringOptional label shown below the bubble
classNamestringAdditional class names on the outer wrapper

Source

packages/ui/src/chat-message.tsx — copy into components/ui/chat-message.tsx in your project.