Thinking UI

Agent Steps

A plan checklist where the connecting line fills as an agent completes each step.

Code

components/thinking-ui/agent-steps.tsx
"use client";

import { AnimatePresence, motion } from "motion/react";
import { useMotion } from "@/lib/motion";
import { cn } from "@/lib/utils";

export type AgentStep = {
  id: string;
  title: string;
  /** Shown only while the step is active. */
  description?: string;
  status: "pending" | "active" | "done";
};

export type AgentStepsProps = {
  steps: AgentStep[];
  className?: string;
};

export function AgentSteps({ steps, className }: AgentStepsProps) {
  const m = useMotion();

  return (
    <ol className={cn("text-sm", className)}>
      {steps.map((step, i) => (
        <li key={step.id} className="relative flex gap-3 pb-5 last:pb-0">
          {i < steps.length - 1 && (
            <span aria-hidden className="absolute bottom-1 left-[9px] top-6 w-px overflow-hidden bg-line">
              <motion.span
                className="absolute inset-0 origin-top bg-fill-contrast"
                initial={false}
                animate={{ scaleY: step.status === "done" ? 1 : 0 }}
                transition={m.tween("slower", "inOut")}
              />
            </span>
          )}
          <StepIndicator status={step.status} />
          <div className="min-w-0 flex-1 pt-px">
            <p className={cn("transition-ui", step.status === "pending" ? "text-fg-muted" : "text-fg")}>
              {step.title}
              <span className="sr-only">
                {step.status === "done" ? " (done)" : step.status === "active" ? " (in progress)" : ""}
              </span>
            </p>
            <AnimatePresence initial={false}>
              {step.status === "active" && step.description && (
                <motion.div className="overflow-hidden" {...m.collapse()}>
                  <p className="pt-1 text-xs leading-relaxed text-fg-muted">{step.description}</p>
                </motion.div>
              )}
            </AnimatePresence>
          </div>
        </li>
      ))}
    </ol>
  );
}

function StepIndicator({ status }: { status: AgentStep["status"] }) {
  const m = useMotion();
  const pop = m.pop();

  return (
    <span className="relative grid size-[19px] shrink-0 place-items-center">
      <AnimatePresence mode="popLayout" initial={false}>
        {status === "pending" && (
          <motion.span key="pending" className="size-[15px] rounded-full border-[1.5px] border-line-strong" {...pop} />
        )}
        {status === "active" && (
          <motion.span key="active" className="relative grid size-[15px] place-items-center" {...pop}>
            <motion.span
              className="absolute inset-0 rounded-full bg-accent-glow"
              animate={{ scale: [1, 1.9], opacity: [0.9, 0] }}
              transition={{ duration: 1.4 * m.scale, ease: m.personality.ease.out, repeat: Infinity }}
            />
            <span className="size-[9px] rounded-full bg-accent" />
          </motion.span>
        )}
        {status === "done" && (
          <motion.svg key="done" viewBox="0 0 16 16" className="size-[17px] text-fg" {...pop}>
            <circle cx="8" cy="8" r="7.5" fill="currentColor" />
            <motion.path
              d="M5 8.2l2 2 4-4.2"
              fill="none"
              stroke="var(--surface-app)"
              strokeWidth="1.6"
              strokeLinecap="round"
              strokeLinejoin="round"
              initial={{ pathLength: 0 }}
              animate={{ pathLength: 1 }}
              transition={{ ...m.tween("slow"), delay: m.stagger(1) }}
            />
          </motion.svg>
        )}
      </AnimatePresence>
    </span>
  );
}

Motion notes

  • The connecting line fills with ease-in-out (scaleY, GPU-only), like a progress bar that's handing off.
  • The active step pulses softly, so there is always one obvious place to look.
  • Descriptions appear only for the active step, which keeps a long plan scannable.

Installation

  1. 1

    Install dependencies

    Terminal
    npm install motion clsx tailwind-merge
  2. 2

    Add the design tokens and motion system (once per project)

    Copy styles/tokens/*, lib/motion.tsx and lib/utils.ts from Get started.

  3. 3

    Paste the source into components/thinking-ui/agent-steps.tsx

    Copy it from the Code tab, or use Copy prompt to let your coding agent do all of this.

Usage

Example
<AgentSteps
  steps={[
    { id: "1", title: "Search", status: "done" },
    { id: "2", title: "Summarise", status: "active" },
  ]}
/>

Props

PropTypeDefaultDescription
stepsAgentStep[]—{ id, title, description?, status: "pending" | "active" | "done" }
classNamestring—Classes for the list.