BranchSwitcher

"2 / 3" for a regenerated reply. Step through versions with the arrows; the count rolls in the direction you moved. AI.

Open playground
2 / 3

About

BranchSwitcher is a React component in the AI category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { BranchSwitcher } from "@ashutoshswamy/smoui" and set index, count, onChange among its 4 props.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { BranchSwitcher } from "@ashutoshswamy/smoui";

<BranchSwitcher index={i} count={3} onChange={setI} onRegenerate={again} />

Props 4

index

Zero-based version shown.

number
count

Number of versions.

number
onChange

Called on arrow press.

(index) => void
onRegenerate

Adds a regenerate button.

() => void