ham7a311

Branch Switcher

AI chats

About

A chat message bubble that turns an edited prompt into a new branch instead of overwriting it, with a pager and a tiny tree to step between answer versions.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Branch Switcher to your project and fits it to your theme.

Code

How Branch Switcher is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import { BranchSwitcher, type Version } from "@/components/ui/branch-switcher";

const V: Version[] = [
  {
    prompt: "Plan a day in Muscat.",
    answer:
      "Morning at the Grand Mosque (it opens at 8:00), the Mutrah souq before the heat, lunch at Bait Al Luban, then the corniche at sunset.",
  },
  {
    prompt: "Plan a day in Muscat with two kids under six.",
    answer:
      "Start at the Children's Museum, picnic in Qurum Natural Park, a short dhow ride at 16:00 when it's cooler, and dinner early on the corniche.",
  },
  {
    prompt: "Plan a slow, cheap day in Muscat — no car.",
    answer:
      "Bus to Mutrah, walk the corniche to the fish market, karak and samosas at a street café, the souq in the evening, and the bus back from Ruwi.",
  },
];

export default function Demo() {
  return (
    <div className="flex min-h-full w-full items-center justify-center p-6 bg-[#efede8]">
      <BranchSwitcher
        theme="paper"
        versions={V}
        reply={(p) =>
          `Here's a plan for "${p}" — I've kept the corniche at sunset, because nothing beats it.`
        }
      />
    </div>
  );
}

More by ham7a311

View all
  • Wave Mesh

    Wave Mesh

    253
  • Route Globe

    Route Globe

    195
  • Glass Tiles

    Glass Tiles

    183
  • Orbit Ring Stats

    Orbit Ring Stats

    82
  • Glyph Swell

    Glyph Swell

    78
  • Fan Deck Card

    Fan Deck Card

    77
  • Ask Bar

    Ask Bar

    63
  • Glass Ribbons

    Glass Ribbons

    53

More in AI chats

View all
  • Agent Chat

    Agent Chat

    21
  • AI Actions

    AI Actions

    372
  • AI Suggestions

    AI Suggestions

    27
  • Interactive LLM Token & Context Window Visualizer

    Interactive LLM Token & Context Window Visualizer

    30
  • AI SaaS Workflow Hero

    AI SaaS Workflow Hero

    36
  • Aquarium Prompt

    Aquarium Prompt

    219
  • Message Parts

    Message Parts

    10
  • AI Chat Composer

    AI Chat Composer

    21