MessageBranches

Regenerated versions of the same answer, navigable without losing your place.

Install it:

npx shadcn add @ambientui/message-branches

Live

Persist the composer draft in the runtime with the thread id as its key. When the active thread changes, read that value back into the composer.
References
1Response kit v0

Behavior

  • ·Wired into the real transcript: MessageActions' regenerate composes the same question again and APPENDS the result, so the assistant's own answers branch exactly as this component describes.
  • ·A regenerated answer does not replace its predecessor — it joins it, and the newest becomes the one you are looking at.
  • ·The pager sits under the answer it belongs to, so a branch reads as a version of THIS reply rather than as a new turn.
  • ·Quiet by design: ghost controls and a monospaced count, because this is navigation, not content. It hides entirely at one version.
  • ·Only a freshly generated branch streams; stepping back to one you have already read shows it settled — history is written, not replayed.
  • ·Arrows disable at the ends rather than wrapping, so the extent of the set is felt.

When to use

  • ·Wherever regeneration is offered — the alternative is silently destroying an answer the user might have preferred.
  • ·When comparing phrasings or approaches matters more than the latest attempt.

When not to

  • ·Across different questions; branches are versions of one answer, not a history.
  • ·For editing a sent message — that is a different object, with its own consequence disclosure.