Chat Thread Widget is a self-contained messaging component that composes ChatBubble, Avatar, TextArea, and Button into a complete conversation thread with send, reply, and reaction UX. It provides a ready-to-use messaging surface for SaaS applications that need in-app chat, support threads, or comment-style conversations. The existing chat-bubble.tsx handles individual message rendering; this widget adds the thread container, input area, message list, and interaction layer.
Goals
Deliver a <ChatThread> component that renders a scrollable message list with a compose input area.
Compose existing ChatBubble, Avatar, TextArea, and Button primitives.
Support send, reply, and emoji reaction interactions.
Handle empty, loading, and error states with appropriate UX.
Ship Storybook stories covering typical chat flows and edge cases.
Non-Goals
Real-time message delivery (WebSocket, SSE, or polling integration).
File or image attachment uploads.
Message search or filtering.
Typing indicators or read receipts beyond ChatBubble’s existing status prop.
End-to-end encryption or message persistence.
Scope
In Scope
Area
Description
Component
<ChatThread> composing message list + input area
Message List
Scrollable container rendering ChatBubble instances with avatars
Compose Input
TextArea + Button for sending new messages
Reply
Reply-to-message UX showing quoted original message above compose input
Flat thread only; nested threading is a separate pattern
User presence / online indicators
Application-layer concern
Users and Pain Points
User Groups
User
Description
Needs
Developers
Engineers building SaaS apps with in-app messaging
A composable chat widget using DS primitives
Designers
Design-system consumers
Consistent chat UI that matches DS visual language
End Users
SaaS application users
Familiar, responsive messaging experience
Pain Points
User
Pain Point
Impact
Developers
Assembling chat UIs from primitives (bubble, input, scroll, reactions) is complex
High development cost, inconsistent chat experiences
End Users
Ad-hoc chat UIs often lack keyboard navigation, screen reader support, and proper focus management
Poor accessibility and usability
Definitions
Term
Definition
Chat Thread
A chronological, flat list of messages between participants
Compose Input
The text input area at the bottom of the thread for writing new messages
Reply
A message that quotes and references a previous message in the thread
Reaction
An emoji response attached to a specific message
Current State
Existing Behavior
ChatBubble in chat-bubble.tsx renders individual sent/received messages with avatar, timestamp, and delivery status. There is no thread container, compose input, reply UX, or reaction system.
Current Limitations
No thread-level component; consumers must build scroll containers and input areas manually.
No reply-to-message pattern.
No emoji reaction support.
No empty/loading/error states for the thread as a whole.
Existing Workarounds
Developers wrap ChatBubble instances in a custom scrollable div and add their own textarea.
Reply and reaction UX are built from scratch in each application.
Proposed Solution
Summary
Introduce <ChatThread> that accepts a messages array and renders them as ChatBubble components in a scrollable container, with a compose input area at the bottom. The component supports onSend for new messages, onReply for reply-to interactions, and onReact for emoji reactions. State management (adding messages to the array) is the consumer’s responsibility.
Key Capabilities
Scrollable message list with auto-scroll to newest message.
Compose input with send button (Enter to send, Shift+Enter for newline).
Reply mode: clicking reply on a message shows the quoted message above the compose input.
Emoji reaction: clicking a reaction button on a message opens a picker; selected emoji is added to the message.
Empty thread: shows a placeholder message encouraging the first message.
Loading state: skeleton bubbles while messages load.
Error state: error banner with retry action.
User Experience
Users see a scrolling list of messages with sent messages on the right and received on the left. Each message has a subtle reaction button and reply button on hover. The compose area at the bottom has a textarea and send button. When replying, a quoted preview of the original message appears above the textarea.