Components / Prompt Builders
Prompt Chain Builder
A visual chain builder for creating multi-step AI prompt workflows with drag-and-drop step reordering.
Components / Prompt Builders
A visual chain builder for creating multi-step AI prompt workflows with drag-and-drop step reordering.
Sequential Logic Graph
Parse unstructured PDF data into schema
Check for hallucination and PII leaks
Generate final executive summary
Install the core libraries required for this component.
npm install react lucide-react"use client";
import React from "react";
import { GitGraph, ArrowDown, Settings, Bot, Sparkles, Database, Search } from "lucide-react";
import { cn } from "@/lib/utils";
const chainSteps = [
{
id: "1",
label: "Extraction",
actor: "Llama-3",
icon: <Database className="h-4 w-4" />,
color: "border-blue-500",
desc: "Parse unstructured PDF data into schema"
},
{
id: "2",
label: "Validation",
actor: "GPT-4o",
icon: <Search className="h-4 w-4" />,
color: "border-violet-500",
desc: "Check for hallucination and PII leaks"
},
{
id: "3",
label: "Synthesis",
actor: "Claude 3.5",
icon: <Sparkles className="h-4 w-4" />,
color: "border-emerald-500",
desc: "Generate final executive summary"
},
];
export default function PromptChainBuilder() {
return (
<div className="rounded-[32px] border border-zinc-200 dark:border-zinc-800 bg-white dark:bg-zinc-950 p-8 shadow-2xl w-full max-w-md mx-auto relative overflow-hidden">
{/* Background Decor */}
<div className="absolute top-0 right-0 h-32 w-32 bg-indigo-500/5 rounded-full blur-3xl" />
<div className="flex items-center justify-between mb-10 relative z-10">
<div className="flex items-center gap-3">
<div className="p-2 rounded-xl bg-zinc-100 dark:bg-zinc-800">
<GitGraph className="h-5 w-5 text-zinc-600 dark:text-zinc-400" />
</div>
<div>
<h3 className="text-sm font-bold text-zinc-900 dark:text-zinc-100">Step Chaining</h3>
<p className="text-[10px] text-zinc-500 font-medium">Sequential Logic Graph</p>
</div>
</div>
<button className="p-2 rounded-xl border border-zinc-100 dark:border-zinc-800 hover:bg-zinc-50 transition-colors">
<Settings className="h-4 w-4 text-zinc-400" />
</button>
</div>
<div className="flex flex-col items-center space-y-4 relative z-10">
{chainSteps.map((s, i) => (
<React.Fragment key={s.id}>
<div className={cn(
"w-full p-5 rounded-2xl bg-zinc-50 dark:bg-zinc-900 border-l-[6px] transition-all hover:scale-[1.03] active:scale-95 cursor-pointer shadow-sm group",
s.color
)}>
<div className="flex items-center justify-between mb-3">
<div className="flex items-center gap-2">
<div className="p-1.5 rounded-lg bg-white dark:bg-zinc-800 shadow-sm transition-colors group-hover:text-indigo-500">
{s.icon}
</div>
<span className="text-[10px] font-black text-zinc-400 uppercase tracking-widest">Step {i + 1}</span>
</div>
<div className="flex items-center gap-1.5 px-2 py-0.5 rounded-full bg-zinc-200/50 dark:bg-zinc-800 text-[9px] font-bold text-zinc-500">
<Bot className="h-2.5 w-2.5" />
{s.actor}
</div>
</div>
<h4 className="text-sm font-bold text-zinc-900 dark:text-zinc-100 mb-1">{s.label} Phase</h4>
<p className="text-[11px] text-zinc-500 leading-relaxed">{s.desc}</p>
</div>
{i < chainSteps.length - 1 && (
<div className="h-10 flex items-center justify-center relative scale-110">
<div className="h-full w-[2px] bg-gradient-to-b from-zinc-200 to-zinc-100 dark:from-zinc-800 dark:to-zinc-900" />
<div className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 p-1 rounded-full bg-white dark:bg-zinc-950 border border-zinc-200 dark:border-zinc-800 shadow-sm animate-pulse">
<ArrowDown className="h-3 w-3 text-zinc-400" />
</div>
</div>
)}
</React.Fragment>
))}
</div>
<div className="mt-8 pt-6 border-t border-zinc-100 dark:border-zinc-800">
<button className="w-full flex items-center justify-center gap-2 py-3 rounded-2xl bg-indigo-600 text-white text-[11px] font-black uppercase tracking-widest hover:bg-indigo-700 transition-all shadow-xl shadow-indigo-500/20 active:scale-[0.98]">
Compile Chain
<Sparkles className="h-3.5 w-3.5" />
</button>
</div>
</div>
);
} "use client";
import React from "react";
import { GitGraph, ArrowDown, Settings, Bot, Sparkles, Database, Search } from "lucide-react";
import { cn } from "@/lib/utils";
const chainSteps = [
{
id: "1",
label: "Extraction",
actor: "Llama-3",
icon: <Database className="h-4 w-4" />,
color: "border-blue-500",
desc: "Parse unstructured PDF data into schema"
},
{
id: "2",
label: "Validation",
actor: "GPT-4o",
icon: <Search className="h-4 w-4" />,
color: "border-violet-500",
desc: "Check for hallucination and PII leaks"
},
{
id: "3",
label: "Synthesis",
actor: "Claude 3.5",
icon: <Sparkles className="h-4 w-4" />,
color: "border-emerald-500",
desc: "Generate final executive summary"
},
];
export default function PromptChainBuilder() {
return (
<div className="rounded-[32px] border border-zinc-200 dark:border-zinc-800 bg-white dark:bg-zinc-950 p-8 shadow-2xl w-full max-w-md mx-auto relative overflow-hidden">
{/* Background Decor */}
<div className="absolute top-0 right-0 h-32 w-32 bg-indigo-500/5 rounded-full blur-3xl" />
<div className="flex items-center justify-between mb-10 relative z-10">
<div className="flex items-center gap-3">
<div className="p-2 rounded-xl bg-zinc-100 dark:bg-zinc-800">
<GitGraph className="h-5 w-5 text-zinc-600 dark:text-zinc-400" />
</div>
<div>
<h3 className="text-sm font-bold text-zinc-900 dark:text-zinc-100">Step Chaining</h3>
<p className="text-[10px] text-zinc-500 font-medium">Sequential Logic Graph</p>
</div>
</div>
<button className="p-2 rounded-xl border border-zinc-100 dark:border-zinc-800 hover:bg-zinc-50 transition-colors">
<Settings className="h-4 w-4 text-zinc-400" />
</button>
</div>
<div className="flex flex-col items-center space-y-4 relative z-10">
{chainSteps.map((s, i) => (
<React.Fragment key={s.id}>
<div className={cn(
"w-full p-5 rounded-2xl bg-zinc-50 dark:bg-zinc-900 border-l-[6px] transition-all hover:scale-[1.03] active:scale-95 cursor-pointer shadow-sm group",
s.color
)}>
<div className="flex items-center justify-between mb-3">
<div className="flex items-center gap-2">
<div className="p-1.5 rounded-lg bg-white dark:bg-zinc-800 shadow-sm transition-colors group-hover:text-indigo-500">
{s.icon}
</div>
<span className="text-[10px] font-black text-zinc-400 uppercase tracking-widest">Step {i + 1}</span>
</div>
<div className="flex items-center gap-1.5 px-2 py-0.5 rounded-full bg-zinc-200/50 dark:bg-zinc-800 text-[9px] font-bold text-zinc-500">
<Bot className="h-2.5 w-2.5" />
{s.actor}
</div>
</div>
<h4 className="text-sm font-bold text-zinc-900 dark:text-zinc-100 mb-1">{s.label} Phase</h4>
<p className="text-[11px] text-zinc-500 leading-relaxed">{s.desc}</p>
</div>
{i < chainSteps.length - 1 && (
<div className="h-10 flex items-center justify-center relative scale-110">
<div className="h-full w-[2px] bg-gradient-to-b from-zinc-200 to-zinc-100 dark:from-zinc-800 dark:to-zinc-900" />
<div className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 p-1 rounded-full bg-white dark:bg-zinc-950 border border-zinc-200 dark:border-zinc-800 shadow-sm animate-pulse">
<ArrowDown className="h-3 w-3 text-zinc-400" />
</div>
</div>
)}
</React.Fragment>
))}
</div>
<div className="mt-8 pt-6 border-t border-zinc-100 dark:border-zinc-800">
<button className="w-full flex items-center justify-center gap-2 py-3 rounded-2xl bg-indigo-600 text-white text-[11px] font-black uppercase tracking-widest hover:bg-indigo-700 transition-all shadow-xl shadow-indigo-500/20 active:scale-[0.98]">
Compile Chain
<Sparkles className="h-3.5 w-3.5" />
</button>
</div>
</div>
);
} Internal functions used to handle component logic.
| Function | Parameters |
|---|---|
| PromptChainBuilder() | None |
All variable declarations found in this component.
| Name | Kind | Value |
|---|---|---|
| chainSteps | | [ |
Every JSX/HTML tag used in this component, with usage count and source.
| Tag | Count | Type | Source |
|---|---|---|---|
| <ArrowDown> | 1× | | lucide-react |
| <Bot> | 1× | | lucide-react |
| <Database> | 1× | | lucide-react |
| <GitGraph> | 1× | | lucide-react |
| <React.Fragment> | 1× | | react |
| <Settings> | 1× | | lucide-react |
| <Sparkles> | 2× | | lucide-react |
| <button> | 2× | | Native HTML |
| <div> | 16× | | Native HTML |
| <h3> | 1× | | Native HTML |
| <h4> | 1× | | Native HTML |
| <p> | 2× | | Native HTML |
| <Search> | 1× | | Native HTML |
| <span> | 1× | | Native HTML |