Skip to content
caliper ui docs

Pro

Branching thread

A conversation that keeps every version: editing a message or trying again starts a branch beside the original, ‹ 2 / 3 › moves between versions, and everything after follows the branch you choose.

Pro
pnpm dlx shadcn@latest add @caliper/branching-thread

Conversation

1 fork on this path
  1. Write a one-line subject for an email telling customers about our price change.
  2. Halden Assistant

    A heads-up about your Halden plan from 1 December.
  3. Make it calmer and say that most people pay the same.
  4. Halden Assistant

    From 1 December, most plans stay the same price. Here’s the detail.

Installs components/ui/branching-thread.tsxDepends on @radix-ui/react-slot, lucide-reactMotion none in component source

When to use

Use it for

  • Chat assistants where people refine questions.
  • Comparing answers without losing any.

Skip it when

  • Support chat with a human; edits there should not fork.

Installation

terminal
pnpm dlx shadcn@latest add @caliper/branching-thread

Adds its 8 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.

Usage

Import it from your copy of the source. The example behind the preview comes with the source. It is built from activePath and BranchingThread.

example.tsx
import { activePath, BranchingThread } from "@/components/ui/branching-thread"

The worked example comes with Pro

The 34-line example behind the preview opens here, ready to copy.

  • 626 Pro parts, blocks and page templates, all with source
  • $149 once, with lifetime updates. No renewal
  • A full refund within 14 days if it is not for you
Checking your licence…

API reference

activePath

component

No props of its own; it accepts the native props of its root element.

BranchingThread

component
PropTypeDefaultDescription
nodes *readonly ThreadNode[]—
onEdit((parentId: string | null, text: string) => void)—Add a new user message under `parentId` with this text; the reply is up to you.
onRegenerate((parentId: string) => void)—Add another answer under `parentId` (the user message).
assistantNamestring"Assistant"
classNamestring—

Accessibility

It exposes group and status semantics, with aria-labelledby, aria-hidden and aria-label kept in step with state. Changes that matter are announced through a live region.

KeyBehaviour
EscapeCloses or cancels, then returns focus to where it came from.
EnterActivates the focused control.

Motion

It declares no animation in its component source. Any transition comes from its stylesheet, which uses the duration tokens that collapse to instant under prefers-reduced-motion.

All Assistant screens examples