Agent activity
An agent's activity stream: each new step rises in while earlier rows glide into place. Adapted from beUI (MIT).
The item is the list and its row motion. Each row's text and glyph are yours, and so is the thinking indicator: a ThinkingOrb from @khaeli/loader.
Steps
Read the March release notes
Compared 14 tasks with the milestone
Found 3 tasks without a reviewer
Drafted the summary
import { CheckIcon } from "@keyline-icons/react"
import { ActivityItem, ActivityList } from "@/components/ui/agent-activity"
const steps = [
"Read the March release notes",
"Compared 14 tasks with the milestone",
"Found 3 tasks without a reviewer",
"Drafted the summary",
]
export default function AgentActivitySteps() {
return (
<ActivityList aria-label="Steps taken" className="w-full max-w-sm gap-2">
{steps.map((step) => (
<ActivityItem key={step} className="flex items-center gap-2">
<CheckIcon aria-hidden className="size-4 shrink-0 text-muted-foreground" />
<span className="truncate">{step}</span>
</ActivityItem>
))}
</ActivityList>
)
}
Steps arriving
Read the March release notes
Compared 14 tasks with the milestone
Found 3 tasks without a reviewer
Drafted the summary
"use client"
import { useEffect, useState } from "react"
import { CheckIcon } from "@keyline-icons/react"
import { ActivityItem, ActivityList } from "@/components/ui/agent-activity"
import { Button } from "@/components/ui/button"
import { ThinkingOrb } from "@/components/ui/loader"
const steps = [
"Read the March release notes",
"Compared 14 tasks with the milestone",
"Found 3 tasks without a reviewer",
"Drafted the summary",
]
export default function AgentActivityStepsArriving() {
const [done, setDone] = useState(steps.length)
const running = done < steps.length
useEffect(() => {
if (!running) return
const timer = setTimeout(() => setDone((count) => count + 1), 900)
return () => clearTimeout(timer)
}, [running, done])
return (
<div className="flex w-full max-w-sm flex-col items-start gap-4">
<ActivityList aria-label="Steps taken" aria-live="polite" className="min-h-34 w-full gap-2">
{steps.slice(0, done).map((step) => (
<ActivityItem key={step} className="flex items-center gap-2">
<CheckIcon aria-hidden className="size-4 shrink-0 text-muted-foreground" />
<span className="truncate">{step}</span>
</ActivityItem>
))}
{running ? (
<ActivityItem key="thinking" className="flex items-center gap-2 text-muted-foreground">
<span className="grid size-4 shrink-0 place-items-center">
<ThinkingOrb state="working" size={20} aria-hidden />
</span>
Thinking
</ActivityItem>
) : null}
</ActivityList>
<Button variant="outline" onClick={() => setDone(running ? steps.length : 0)}>
{running ? "Finish now" : "Run again"}
</Button>
</div>
)
}
Installation
npx shadcn@latest add @khaeli/agent-activitybunx --bun shadcn@latest add @khaeli/agent-activityInstall @khaeli/foundation first: this item's styling lives in its tokens and [data-slot] rules.
Installs with
- Registry items
- npm packages
- motion ^12.23.12
Accessible name
ActivityListis alistand eachActivityItemalistitem. Name the list witharia-label, such as Steps taken.- A row that arrives is not announced by the item. Add
aria-live="polite"to the list when the steps should be read out as they land. - A glyph or orb beside a row's text is decorative: hide it with
aria-hidden. - With reduced motion a row fades in where it belongs and nothing moves.
Registry JSON
The item as the shadcn CLI reads it, with every file it ships: https://ui.khaeli.com/r/agent-activity.json