Skip to content
Sign upGet access
MicrointeractionsRegenerate stackMenu

Regenerate stack (Pro)

ProIncluded in $99

Answer versions as a deck: regenerate and the old answer slips back into a stack behind the new one, and stepping through brings each card forward.

ProRegenerate and the old answer slips back into a stack behind the new one; step through versions and the deck reorders.

Regenerate usually makes the answer you had disappear behind a 2 / 2 counter. Here it slips back and up into a deck behind the new one, its edge still showing, so you can see you kept it. Every version is a card in the same deck: stepping through brings that card forward while the others settle behind it in order of distance, and the count rolls with them. A version still being written shows the Thinking style label over skeleton lines.

Installation

$ pnpm dlx shadcn@latest add @chatcn-pro/regenerate-stack

Needs chatcn Pro

This command works with a Pro license, along with every Pro component.

Or start free: sign up and get three Pro components on us, with a new one every month.

Usage

tsx
import { RegenerateStack } from "@/components/ui/chatcn/pro/regenerate-stack"

<RegenerateStack
  versions={versions}
  index={index}
  onIndexChange={setIndex}
  onRegenerate={regenerate}
/>

Props

PropTypeNotes
versions{ id, content: ReactNode | null }[]null content while that version is being written
indexnumberThe version in front
onIndexChange(index: number) => void
onRegenerate() => voidShows the Regenerate button
pendingLabelstringDefault "Writing another version"

Accessibility

  • Only the front card is in the accessibility tree; cards behind are inert.
  • The count is announced politely as it changes.

Motion

  • Cards move on translate, scale and opacity only, 380 ms. Up to two edges peek, 8 px apart.
  • The deck eases to the front card's height, measured live so a streaming version grows the deck with it.
  • The regenerate icon makes one full turn per press. Reduced motion keeps the fades.