Cameron Kelliher

AI Conversation Tree

AI chats 33

About

A compound component that visualizes branching AI conversations as an expandable tree with node type indicators, active path highlighting, and click-to-navigate selection.

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

Code

How AI Conversation Tree is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import {
  AiConversationTree,
  AiConversationTreeContent,
  AiConversationTreeHeader,
  AiConversationTreePreview,
  type ConversationNode,
} from "@/components/ui/conversation-tree";

const DEMO_NODES: ConversationNode[] = [
  {
    id: "1",
    type: "user",
    content: "How do I implement auth?",
    isActive: true,
    children: [
      {
        id: "2",
        type: "assistant",
        content:
          "There are several approaches to implementing authentication. You could use OAuth, JWT, or session-based auth...",
        isActive: true,
        children: [
          {
            id: "3",
            type: "user",
            content: "What about OAuth?",
          },
          {
            id: "4",
            type: "user",
            content: "Tell me about JWT",
            isActive: true,
            children: [
              {
                id: "5",
                type: "assistant",
                content:
                  "JWT (JSON Web Tokens) are a compact, URL-safe means of representing claims between two parties...",
                isActive: true,
              },
            ],
          },
          {
            id: "6",
            type: "user",
            content: "Session-based auth?",
          },
        ],
      },
    ],
  },
];

export default function AiConversationTreeDemo() {
  return (
    <div className="flex w-full items-center justify-center p-6">
      <AiConversationTree
        nodes={DEMO_NODES}
        activeNodeId="5"
        defaultExpandAll
        className="w-full max-w-lg"
      >
        <AiConversationTreeHeader />
        <AiConversationTreeContent />
        <AiConversationTreePreview />
      </AiConversationTree>
    </div>
  );
}

Dependencies

More by Cameron Kelliher

View all
  • AI Chain of Thought

    AI Chain of Thought

    111
  • Helix Loader

    Helix Loader

    94
  • AI Streaming Text

    AI Streaming Text

    50
  • AI Tool Call

    AI Tool Call

    45
  • Signal Bars Loader

    Signal Bars Loader

    41
  • Glitch Text Loader

    Glitch Text Loader

    41
  • AI Prompt Diff

    AI Prompt Diff

    39
  • AI Routing Indicator

    AI Routing Indicator

    34

More in AI chats

View all
  • AI Actions

    AI Actions

    319
  • Agent Chat

    Agent Chat

    17
  • System Message

    System Message

    54
  • Message Thread

    Message Thread

    35
  • Color Picker

    Color Picker

    81
  • AI Task List

    AI Task List

    160
  • Modal Card

    Modal Card

    101
  • Quota Banner

    Quota Banner

    21