Agents›Agent Status

Agent Status

What an AI agent is doing in one calm line: the running step shimmers, steps replace each other with a slide and blur, the spinner morphs into a check as it settles into "Done in 4.2s", and a click opens the steps it went through.

Copy a ready prompt for Claude Code, Codex or Cursor

Seen on

Original to Copia

Dependencies

reacttailwindcssmotionlucide-react

Interaction type

morph

Install via CLI

pnpm dlx shadcn@latest add @copia/agent-status

Without the namespace: npx shadcn@latest add https://copia-ui.vercel.app/r/agent-status.json

How to use

demo.tsx
"use client"

import { useEffect, useState } from "react"
import { AgentStatus, type AgentStatusProps } from "./agent-status"

const STEPS = [
  { label: "Thinking…" },
  { label: "Searching the web…", detail: "spring physics UI motion" },
  { label: "Reading 3 sources…", detail: "emilkowal.ski, rauno.me, apple.com" },
  { label: "Writing the answer…" },
]

/** A run that loops: four steps, done, then again; open the steps to follow along. */
export default function Demo({ doneColor = "#30d158" }: Pick<AgentStatusProps, "doneColor">) {
  const [current, setCurrent] = useState(0)

  useEffect(() => {
    if (matchMedia("(prefers-reduced-motion: reduce)").matches) return
    const id = setInterval(() => setCurrent((c) => (c + 1) % (STEPS.length + 2)), 1100)
    return () => clearInterval(id)
  }, [])

  const done = current >= STEPS.length
  return (
    <div className="grid flex-1 place-items-center p-6">
      <div className="flex w-full max-w-sm flex-col gap-3 rounded-2xl bg-muted/40 p-4">
        <p className="text-sm">How do I make UI feel physical?</p>
        <AgentStatus steps={STEPS} current={Math.min(current, STEPS.length - 1)} done={done} duration={4.2} doneColor={doneColor} />
      </div>
    </div>
  )
}

Customization

Use the sliders button at the top right of the preview to tweak doneColor live and copy the generated JSX.

Props

PropTypeDefaultDescription
steps{ label, detail? }[]-Steps in order.
currentnumber-Index of the running step; earlier ones are done.
donebooleanfalseAll steps finished.
durationnumber-Seconds the run took, shown once done.
doneColorstring"#30d158"Colour of the finished check.

Attribution

Original component. Recreated by Copia.

Read how it was reverse engineered

Source code

agent-status.tsx
"use client"

import { AnimatePresence, motion, useReducedMotion } from "motion/react"
import { Check, ChevronDown } from "lucide-react"
import { useState } from "react"
import { cn } from "@/lib/utils"

export type AgentStep = { label: string; detail?: string }

export type AgentStatusProps = {
  steps: AgentStep[]
  /** Index of the step running now. Past steps are done. */
  current: number
  /** All steps finished. */
  done?: boolean
  /** Seconds the run took, shown once done. */
  duration?: number
  /** Colour of the finished check. */
  doneColor?: string
  className?: string
}

const SWAP = { type: "spring", bounce: 0.2, duration: 0.45 } as const
const LINE = {
  initial: { opacity: 0, y: 8, filter: "blur(4px)" },
  animate: { opacity: 1, y: 0, filter: "blur(0px)" },
  exit: { opacity: 0, y: -8, filter: "blur(4px)" },
}

/** A small spinner drawn as an arc, so it reads at 14px. */
function Spinner() {
  return (
    <svg viewBox="0 0 16 16" className="size-3.5 animate-spin text-muted-foreground motion-reduce:animate-none" aria-hidden>
      <circle cx="8" cy="8" r="6" fill="none" stroke="currentColor" strokeOpacity="0.25" strokeWidth="2" />
      <path d="M8 2a6 6 0 0 1 6 6" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" />
    </svg>
  )
}

/**
 * What an agent is doing, in one calm line: the running step shimmers, steps
 * replace each other by sliding up with a blur, and the line settles into
 * "Done in 4.2s" with a check. Click it to open the steps it went through.
 */
export function AgentStatus({ steps, current, done = false, duration, doneColor = "#30d158", className }: AgentStatusProps) {
  const [open, setOpen] = useState(false)
  const reduced = useReducedMotion()
  const step = steps[Math.min(current, steps.length - 1)]
  const headline = done ? (duration !== undefined ? `Done in ${duration.toFixed(1)}s` : "Done") : step?.label
  const transition = reduced ? { duration: 0 } : SWAP

  return (
    <div className={cn("flex w-full max-w-sm flex-col text-sm", className)}>
      <button
        type="button"
        aria-expanded={open}
        onClick={() => setOpen((o) => !o)}
        className="flex h-8 items-center gap-2.5 rounded-lg text-left outline-none focus-visible:ring-2 focus-visible:ring-ring"
      >
        <span className="grid size-4 shrink-0 place-items-center">
          <AnimatePresence initial={false} mode="popLayout">
            {done ? (
              <motion.span key="done" initial={{ scale: 0.4, opacity: 0 }} animate={{ scale: 1, opacity: 1 }} transition={transition} style={{ color: doneColor }}>
                <Check className="size-4" strokeWidth={2.75} />
              </motion.span>
            ) : (
              <motion.span key="run" exit={{ scale: 0.4, opacity: 0 }} transition={transition}>
                <Spinner />
              </motion.span>
            )}
          </AnimatePresence>
        </span>
        <span className="relative h-5 min-w-0 flex-1 overflow-hidden">
          <AnimatePresence initial={false} mode="popLayout">
            <motion.span
              key={headline}
              {...LINE}
              transition={transition}
              className={cn(
                "block truncate",
                done
                  ? "text-muted-foreground"
                  : // The running step shimmers: a light band sweeping across the text.
                    "animate-[agent-shimmer_1.6s_linear_infinite] bg-[linear-gradient(90deg,var(--muted-foreground)_0%,var(--muted-foreground)_40%,var(--foreground)_50%,var(--muted-foreground)_60%,var(--muted-foreground)_100%)] bg-[length:250%_100%] bg-clip-text text-transparent motion-reduce:animate-none",
              )}
            >
              {headline}
            </motion.span>
          </AnimatePresence>
        </span>
        <ChevronDown className={cn("size-4 shrink-0 text-muted-foreground transition-transform duration-300", open && "rotate-180")} aria-hidden />
      </button>

      <AnimatePresence initial={false}>
        {open && (
          <motion.ol
            initial={{ height: 0, opacity: 0 }}
            animate={{ height: "auto", opacity: 1 }}
            exit={{ height: 0, opacity: 0 }}
            transition={transition}
            className="overflow-hidden"
          >
            {steps.map((s, i) => {
              const state = done || i < current ? "done" : i === current ? "running" : "waiting"
              return (
                <li key={s.label} className="flex items-start gap-2.5 py-1.5 pl-[3px]">
                  <span className={cn("mt-1.5 size-2.5 shrink-0 rounded-full", state === "waiting" ? "bg-muted" : state === "running" ? "bg-foreground" : "bg-muted-foreground/60")} />
                  <span className="flex min-w-0 flex-col">
                    <span className={cn(state === "waiting" ? "text-muted-foreground/60" : state === "running" ? "text-foreground" : "text-muted-foreground")}>{s.label}</span>
                    {s.detail && <span className="truncate text-xs text-muted-foreground">{s.detail}</span>}
                  </span>
                </li>
              )
            })}
          </motion.ol>
        )}
      </AnimatePresence>

      <span className="sr-only" aria-live="polite">
        {headline}
      </span>
      <style>{"@keyframes agent-shimmer { from { background-position: 100% 0 } to { background-position: -150% 0 } }"}</style>
    </div>
  )
}

Keep in mind

Most components here are recreations of the best interfaces out there. We don't claim to be the original creators: this is our attempt to reverse engineer, replicate and often add a few features. We credit everyone we can; if we missed someone, let us know.

Contact

Found a bug or a missing credit? Open an issue

License & usage

  • — Free to use and modify in personal and commercial projects (MIT).
  • — No attribution required, but a link back to Copia is appreciated.
  • — Demo images are not part of the license; replace them with your own.
PreviousToolbar TooltipNext Copy Button

How do I make UI feel physical?

Thinking…