Branch
Step through versions of a response after regenerating. New versions are selected as they arrive.
Installation
pnpm dlx shadcn@latest add @jds/branch
Usage
import { Branch, BranchContent, BranchSelector } from "@/components/ai/branch"
<Branch count={versions.length}>
<BranchContent>
{versions.map((v) => <Response key={v.id}>{v.text}</Response>)}
</BranchContent>
<BranchSelector />
</Branch>API Reference
Branch
| Prop | Type | Default |
|---|---|---|
countNumber of versions. Growing it selects the newest. | number | – |
indexControlled active version. | number | – |
onIndexChange | (index: number) => void | – |