Skip to content
Sign upPro
Chat layoutsSplit threadsMenu

Split threads (Pro)

ProIncluded in $99

Two threads side by side, for comparing models or prompts: one composer for either side or both, linked scrolling, and swap.

ProTwo prompt variants on the same model get one question at once, are read side by side, then swap sides.

Installation

$ pnpm dlx shadcn@latest add @chatcn-pro/split-threads

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

tsx
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

ProBoth answered with close and swap, one still answering, and one side failed.

Props

PropTypeNotes
panes[SplitPane, SplitPane]{ id, title, subtitle?, messages, status?, error?, onRetry?, onStop? }
onSend(ids, text) => voidids is one side or both
onReorder([a, b]) => voidShows Swap sides
onClose(id) => voidShows a close button on each side
defaultLinkedbooleanScroll together. Default on
value, onValueChangestringThe draft, controlled or not
disabledboolean
labelsPartial<SplitThreadsLabels>Every string, for translation

Keyboard

KeyAction
Arrow keys in Send toChoose Both or one side
Enter, Shift EnterSend, new line
EscapeStop 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.