Branch picker primitives for navigating regenerated assistant responses and alternate message paths inside a chat thread.
For examples and usage patterns, see BranchPicker.
Anatomy
import { BranchPickerPrimitive } from "@assistant-ui/react";
const BranchPicker = () => (
<BranchPickerPrimitive.Root>
<BranchPickerPrimitive.Previous />
<BranchPickerPrimitive.Number /> / <BranchPickerPrimitive.Count />
<BranchPickerPrimitive.Next />
</BranchPickerPrimitive.Root>
);API Reference
Root
The root container for branch picker components. This component provides a container for branch navigation controls, with optional conditional rendering based on the number of available branches. It integrates with the message branching system to allow users to navigate between different response variations.This primitive renders a <div> element unless asChild is set.
BranchPickerPrimitiveRootPropsasChild: boolean= falseChange the default rendered element for the one passed as a child, merging their props and behavior.
Read the Composition guide for more details.render?: ReactElementhideWhenSingleBranch: boolean= falseWhether to hide the branch picker when there's only one branch available. When true, the component will only render when multiple branches exist.
Next
A button component that navigates to the next branch in the message tree. This component automatically handles switching to the next available branch and is disabled when there are no more branches to navigate to.This primitive renders a <button> element unless asChild is set.
BranchPickerPrimitiveNextPropsasChild: boolean= falseChange the default rendered element for the one passed as a child, merging their props and behavior.
Read the Composition guide for more details.render?: ReactElement
Previous
A button component that navigates to the previous branch in the message tree. This component automatically handles switching to the previous available branch and is disabled when there are no previous branches to navigate to.This primitive renders a <button> element unless asChild is set.
BranchPickerPrimitivePreviousPropsasChild: boolean= falseChange the default rendered element for the one passed as a child, merging their props and behavior.
Read the Composition guide for more details.render?: ReactElement