Split threads (Pro)
ProIncluded in $99Two threads side by side, for comparing models or prompts: one composer for either side or both, linked scrolling, and swap.
On this page
Installation
Needs chatcn Pro
This command works with a Pro license, along with every Pro component.
Or start free: sign up and get three Pro components on us, with a new one every month.
Usage
import { SplitThreads } from "@/components/ui/chatcn/pro/split-threads"
<SplitThreads
panes={[
{ id: "a", title: "Prompt A", subtitle: "concise", messages: a.messages, status: a.status },
{ id: "b", title: "Prompt B", subtitle: "with examples", messages: b.messages, status: b.status },
]}
onSend={(ids, text) => ids.forEach((id) => ask(id, text))}
onReorder={setOrder}
/>Each side is its own thread with its own status, so one can still be answering while the other is done or has failed. One composer sends to Both, or to one side, so a comparison asks the same question twice without retyping it. Scroll together keeps the two answers level as you read, by proportion, so a long answer and a short one stay aligned; turn it off to read them apart. Swap sides puts the one you prefer where you want it; Close turns the layout back into one thread through onClose. On a host narrower than 720 px the sides stack behind a switch.
Examples
States
Props
| Prop | Type | Notes |
|---|---|---|
panes | [SplitPane, SplitPane] | { id, title, subtitle?, messages, status?, error?, onRetry?, onStop? } |
onSend | (ids, text) => void | ids is one side or both |
onReorder | ([a, b]) => void | Shows Swap sides |
onClose | (id) => void | Shows a close button on each side |
defaultLinked | boolean | Scroll together. Default on |
value, onValueChange | string | The draft, controlled or not |
disabled | boolean | |
labels | Partial<SplitThreadsLabels> | Every string, for translation |
Keyboard
| Key | Action |
|---|---|
| Arrow keys in Send to | Choose Both or one side |
| Enter, Shift Enter | Send, new line |
| Escape | Stop both answers while they stream |
Accessibility
- Each side is a labelled region with its own polite live region, so both answers are announced.
- Send to is a toggle group, and the input's placeholder says where the message will go.
- Scroll together is a pressed or not pressed button with its state in the label.
- On phones the hidden side is removed from the accessibility tree, not just covered.
Motion
Sides enter with a short rise when they appear or swap. Linked scrolling moves the other side with no easing of its own. Under reduced motion sides appear in place.