ChatThread

The conversation container that ties all arclo components together. A compound component for rendering chat UIs with user, assistant, and system messages — complete with avatars, timestamps, and auto-scrolling.

ChatThread — Live Demo
Today's conversation — Claude 3.5 Sonnet
Y
You2:34 PM
Can you optimize this Fibonacci function? It's running really slow for large inputs.

Click "Start conversation" to see the assistant reply

ChatThread.Avatar — Variants

Avatar styles

AI
Initials
C
Custom color
O
Ocean
F
Forest
S
Sunset
Icon

Sizes

S
20
M
28
L
36
XL
48

In conversation

Y
You
What models do you support?
C
Claude
I support Claude Sonnet, Opus, and Haiku — each optimized for different use cases.
G
GPT-4
I'm GPT-4, trained by OpenAI. I excel at reasoning and creative tasks.

Import

tsx
import { ChatThread } from "@arc-lo/ui";

Basic usage

tsx
<ChatThread.Root>
  <ChatThread.Messages>
    <ChatThread.UserMessage name="You">
      Hello!
    </ChatThread.UserMessage>
    <ChatThread.AssistantMessage name="Claude">
      Hi there! How can I help?
    </ChatThread.AssistantMessage>
    <ChatThread.ScrollAnchor />
  </ChatThread.Messages>
</ChatThread.Root>

With all parts

tsx
<ChatThread.Root className="h-[600px]">
  <ChatThread.Messages>
    <ChatThread.SystemMessage>
      New conversation started
    </ChatThread.SystemMessage>

    <ChatThread.UserMessage
      name="You"
      timestamp="2:34 PM"
      avatar={<Avatar src="/me.jpg" />}
    >
      Can you analyze this code?
    </ChatThread.UserMessage>

    <ChatThread.AssistantMessage
      name="Claude"
      timestamp="2:34 PM"
      avatar={<ClaudeIcon />}
    >
      <ThinkingBlock.Root state="done">
        <ThinkingBlock.Trigger>Analyzing</ThinkingBlock.Trigger>
        <ThinkingBlock.Content>...</ThinkingBlock.Content>
      </ThinkingBlock.Root>

      <StreamingText.Root stream={stream}>
        <StreamingText.Content />
        <StreamingText.Cursor />
      </StreamingText.Root>

      <FeedbackBar.Root onFeedback={handleFeedback}>
        <FeedbackBar.ThumbsUp />
        <FeedbackBar.ThumbsDown />
        <FeedbackBar.Copy />
      </FeedbackBar.Root>
    </ChatThread.AssistantMessage>

    <ChatThread.ScrollAnchor />
  </ChatThread.Messages>
</ChatThread.Root>

Using the generic Message

tsx
// UserMessage, AssistantMessage, SystemMessage are
// convenience wrappers around Message with role pre-set.
<ChatThread.Message role="user" name="You">
  Same as ChatThread.UserMessage
</ChatThread.Message>

Sub-components

PartDescription
RootFlex column container for the entire thread
MessagesScrollable area that holds all messages
MessageGeneric message with explicit role prop
UserMessageRight-aligned message with accent background
AssistantMessageLeft-aligned message with subtle border
SystemMessageCentered, muted, smaller informational text
ScrollAnchorAuto-scrolls to bottom when new messages arrive

Props

Root
PropTypeDefaultDescription
childrenReactNodeThread content (Messages, etc.)
classNamestringAdditional CSS classes
Messages
PropTypeDefaultDescription
childrenReactNodeMessage components
classNamestringAdditional CSS classes
Message / UserMessage / AssistantMessage / SystemMessage
PropTypeDefaultDescription
role"user" | "assistant" | "system"Message role (pre-set on convenience wrappers)
avatarReactNodeAvatar element (icon, image, initials)
namestringDisplay name for the author
timestampstringTimestamp string
childrenReactNodeMessage content — any arclo components work here
ScrollAnchor
PropTypeDefaultDescription
classNamestringAdditional CSS classes