Message ThreadPRO
The conversation: every message part rendered by its component, stick-to-bottom scrolling, edit-and-resend.
Code
17 files · 2,270 lines of TypeScriptPRO
Message Thread is part of Pro
Get its source, the one-paste agent prompt and all 113 components, for a one-time $99.
Motion notes
- Renders `useChat` messages directly: text parts stream as Markdown, reasoning becomes Thinking, tool calls become ToolCall, sources collect into SourceCards. `renderPart` overrides any of them.
- Pinned to the newest content until you scroll up; then a pill counts the replies that arrived and jumps back down.
- User turns edit inline and resend from that point; finished replies reveal copy, regenerate and feedback on hover.
- Off-screen turns use `content-visibility: auto`, so a long conversation skips layout and paint for what you can't see.
Usage
Example
const { messages, status, send, edit, regenerate } = useChat();
<MessageThread messages={messages} status={status} onEdit={edit} onRegenerate={regenerate} />
<PromptInput onSubmit={send} isGenerating={status === "streaming"} />Props
| Prop | Type | Default | Description |
|---|---|---|---|
| messages | ChatMessage[] | — | From useChat. |
| status | "idle" | "submitted" | "streaming" | "error" | "idle" | From useChat. |
| onEdit | (id, text) => void | — | Enables edit-and-resend on user turns. |
| onRegenerate | (id) => void | — | Shows regenerate on assistant turns. |
| renderPart | (part, ctx) => ReactNode | undefined | — | Custom renderers per part. |
| empty | ReactNode | — | Shown with no messages. |