Skip to content
Sign upGet access
MicrointeractionsBranch forkMenu

Branch fork (Pro)

ProIncluded in $99

Forking a conversation drawn as it happens: a new lane bends out of the message's node and runs down to a fresh row.

ProBranch from any message: a new lane bends out of its node and runs down to a fresh row, and the messages it leaves behind dim.

Every message is a node on the thread's rail. Pick Branch on one and a new lane bends out of that node and runs down beside the rail to a new row; the messages it leaves behind dim to show they stay on the old line. Branch somewhere else and the lane grows from the new node instead. The new row takes any children, usually a composer.

Installation

$ pnpm dlx shadcn@latest add @chatcn-pro/branch-fork

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 { BranchFork } from "@/components/ui/chatcn/pro/branch-fork"

<BranchFork messages={map} forkAt={forkAt} onFork={setForkAt} branchLabel="Try a SharedWorker">
  <Composer />
</BranchFork>

Props

PropTypeNotes
messages{ id, role: "user" | "assistant", text }[]One line each: the thread as a map
forkAtstring | nullThe message the branch grows from
onFork(id: string | null) => voidShows Branch on rows and Back to main
branchLabelstringDefault "New branch"
childrenReactNodeUnder the branch label

Accessibility

  • The map is an ordered list. Branch buttons show on hover and focus, always on touch.
  • The new row is inert until a branch exists.

Motion

  • The lane draws with stroke-dashoffset, 520 ms ease in out; the new node pops at the end.
  • Reduced motion: the lane and node appear at once.