Browse components
ChatComponent
Message Branch
Branch switcher for an AI chat message that has several alternative responses (regenerations, forks). MessageBranch holds the current index, MessageBranchContent shows one child branch at a time, and MessageBranchSelector composes MessageBranchPrevious, MessageBranchPage ("2 of 3") and MessageBranchNext in a button-group with wrap-around navigation. Use it inside a message to let users flip between regenerated answers; pairs with @uifiles/response for markdown branches.
pnpm dlx shadcn@latest add @uifiles/branch
Installs with
Three alternative responses
Arrow through the regenerations of one assistant turn; the selector shows which of the three is on screen.
Use revalidate: 60 on the fetch. It keeps the page fast and the data no more than a minute stale.