Play-by-play
AI reasoning, activity logs. Each moment drops into the commentary, then folds away.
- Sport
- Football
- Move
- Each moment drops into the commentary, then folds away.
- For
- AI reasoning, activity logs
steps drop in, settle 320ms · folds when done · reduced: fades
01 Install
npx shadcn@latest add https://moveui-red.vercel.app/r/play-by-play.jsonIt brings the tokens with it, and Dribble, which it uses. The first time, import the tokens once in your root layout:
import "@/components/moveui/tokens.css";Not using shadcn? Copy the files below into components/moveui/, and tokens.css next to them.
02 Use it
import { PlayByPlay } from "@/components/moveui/play-by-play/play-by-play";
<PlayByPlay
running={busy}
seconds={4}
plays={[
{ at: 0, kind: "Read", text: "Opened the match report" },
{ at: 2, kind: "Search", text: "Looked up last season's table" },
]}
/>03 Or ask your agent
Paste this into Claude Code, Cursor or any coding agent. It installs the piece and wires it in.
Add the Move UI "Play-by-play" piece to this project. It's for: AI reasoning, activity logs.
1. Install it: npx shadcn@latest add https://moveui-red.vercel.app/r/play-by-play.json
2. If the project doesn't import the Move UI tokens yet, add this once to the root layout: import "@/components/moveui/tokens.css";
3. Use it like this, adapted to where it belongs in my code:
import { PlayByPlay } from "@/components/moveui/play-by-play/play-by-play";
<PlayByPlay
running={busy}
seconds={4}
plays={[
{ at: 0, kind: "Read", text: "Opened the match report" },
{ at: 2, kind: "Search", text: "Looked up last season's table" },
]}
/>
Keep its reduced-motion behaviour and keyboard support. Don't hardcode durations, easing or colours: they come from the --ml-* tokens.
Docs: https://moveui-red.vercel.app/pieces/play-by-playWant your agent to know the whole library and its motion rules? Add the Move UI skill to your project:
npx shadcn@latest add https://moveui-red.vercel.app/r/skill.json04 Code
"use client";
import { useId, useState, type ReactNode } from "react";
import { Dribble } from "../dribble/dribble";
import "./play-by-play.css";
/**
* Play-by-play: an agent's thinking trace, written like match commentary.
* While it runs, the header shows a Dribble loader and each new step drops into the timeline.
* When it is done, the header settles to "Thought for 4 seconds" and the trace folds away,
* one click from being read again. The trace opens with the Half-time accordion motion (grid rows).
* Steps are an ordered list; the header is a real button with aria-expanded.
*/
export type Play = {
/** Seconds since the start, shown as the minute mark. */
at: number;
/** A short tag: Read, Search, Plan, Code, Check... */
kind: string;
text: ReactNode;
/** Optional detail under the step: sources, a code line, a result. */
detail?: ReactNode;
};
type Props = {
plays: Play[];
running: boolean;
/** Total time, shown when done. */
seconds?: number;
runningLabel?: string;
defaultOpen?: boolean;
};
export function PlayByPlay({ plays, running, seconds, runningLabel = "Thinking", defaultOpen = false }: Props) {
const [openState, setOpen] = useState(defaultOpen);
const open = running || openState; // the trace stays visible while it runs
const id = useId();
const total = seconds ?? plays.at(-1)?.at ?? 0;
return (
<div className="ml-pbp" data-open={open ? "" : undefined} data-running={running ? "" : undefined}>
<button
type="button"
className="ml-pbp__head"
aria-expanded={open}
aria-controls={id}
disabled={running}
onClick={() => setOpen((o) => !o)}
>
{running ? (
<Dribble label={plays.at(-1)?.kind ? `${runningLabel}: ${plays.at(-1)!.kind.toLowerCase()}` : runningLabel} variant="rondo" />
) : (
<span className="ml-pbp__done">
<svg className="ml-pbp__whistle" viewBox="0 0 16 16" aria-hidden="true"><circle cx="8" cy="8" r="6.5" /><path d="M5 8.2 7.1 10.2 11 6" /></svg>
Thought for {Math.max(1, Math.round(total))} second{Math.round(total) === 1 ? "" : "s"}
</span>
)}
{!running && <span className="ml-pbp__chev" aria-hidden="true" />}
</button>
<div
id={id}
className="ml-pbp__panel"
inert={!open}
onClick={() => { if (!running && !getSelection()?.toString()) setOpen(false); }}
>
<ol className="ml-pbp__list">
{plays.map((p, i) => (
<li key={i} className="ml-pbp__play">
<span className="ml-pbp__min">{p.at.toFixed(1)}s</span>
<span className="ml-pbp__kind">{p.kind}</span>
<span className="ml-pbp__text">{p.text}</span>
{p.detail && <span className="ml-pbp__detail">{p.detail}</span>}
</li>
))}
</ol>
</div>
</div>
);
}
/*
Play-by-play. Panel: grid rows 0fr to 1fr, --ml-dur-base with --ml-ease-settle; closes on --ml-dur-exit.
New step: drops 6px into place with --ml-ease-settle and the timeline line draws down to it.
Done: the check pops in (Kick) as the header settles. Reduced motion: quick fades, no drop.
*/
.ml-pbp { width: 100%; font-size: 0.875rem; }
.ml-pbp__head {
appearance: none;
display: inline-flex;
align-items: center;
gap: 0.5rem;
min-height: 2.25rem;
padding: 0.25rem 0;
border: 0;
background: none;
color: var(--ml-fg-muted);
font: inherit;
cursor: pointer;
}
.ml-pbp__head:disabled { cursor: default; }
.ml-pbp__head:not(:disabled):hover { color: var(--ml-fg); }
.ml-pbp__head:focus-visible { outline: 2px solid var(--ml-focus); outline-offset: 2px; }
.ml-pbp__done { display: inline-flex; align-items: center; gap: 0.6rem; }
.ml-pbp__whistle {
width: 16px; height: 16px; flex: none;
fill: none; stroke: var(--ml-win); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
animation: ml-pbp-kick var(--ml-dur-base) var(--ml-ease-settle) both;
}
@keyframes ml-pbp-kick { from { opacity: 0; scale: 0.5; } }
.ml-pbp__chev {
width: 7px; height: 7px; margin-left: 0.15rem;
border: solid currentColor; border-width: 0 1.5px 1.5px 0;
rotate: 45deg; translate: 0 -2px;
transition: rotate var(--ml-dur-base) var(--ml-ease-settle), translate var(--ml-dur-base) var(--ml-ease-settle);
}
[data-open] > .ml-pbp__head .ml-pbp__chev { rotate: 225deg; translate: 0 2px; }
.ml-pbp__panel {
display: grid;
grid-template-rows: 0fr;
transition: grid-template-rows var(--ml-dur-exit) var(--ml-ease-out);
}
[data-open] > .ml-pbp__panel {
grid-template-rows: 1fr;
transition: grid-template-rows var(--ml-dur-base) var(--ml-ease-settle);
}
:not([data-running])[data-open] > .ml-pbp__panel { cursor: pointer; }
.ml-pbp__list { min-height: 0; overflow: hidden; list-style: none; margin: 0; padding: 0; }
/* The timeline: a line down the left, a mark on each play */
.ml-pbp__play {
position: relative;
display: grid;
grid-template-columns: 3.25rem 4.5rem 1fr;
column-gap: 0.5rem;
align-items: baseline;
padding: 0.55rem 0 0.55rem 1rem;
animation: ml-pbp-drop var(--ml-dur-base) var(--ml-ease-settle) both;
}
.ml-pbp__play:first-child { margin-top: 0.4rem; }
.ml-pbp__play::before {
content: "";
position: absolute;
left: 3px; top: 0; bottom: 0;
width: 1px;
background: var(--ml-line);
transform-origin: top;
animation: ml-pbp-line var(--ml-dur-base) var(--ml-ease-out) both;
}
.ml-pbp__play::after {
content: "";
position: absolute;
left: 0; top: 0.95rem;
width: 7px; height: 7px;
border-radius: 50%;
background: var(--ml-bg);
border: 1.5px solid var(--ml-ink);
}
[data-running] .ml-pbp__play:last-child::after { background: var(--ml-ink); }
.ml-pbp__min { font-family: var(--font-geist-mono), ui-monospace, monospace; font-size: 0.75rem; color: var(--ml-fg-muted); font-variant-numeric: tabular-nums; }
.ml-pbp__kind { font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; }
.ml-pbp__text { color: var(--ml-fg); line-height: 1.4; }
.ml-pbp__detail {
grid-column: 3;
margin-top: 0.35rem;
padding: 0.45rem 0.55rem;
border-radius: var(--ml-radius);
background: var(--ml-surface-2);
font-family: var(--font-geist-mono), ui-monospace, monospace;
font-size: 0.75rem;
color: var(--ml-fg-muted);
white-space: pre-wrap;
}
@keyframes ml-pbp-drop { from { opacity: 0; translate: 0 -6px; } }
@keyframes ml-pbp-line { from { scale: 1 0; } }
@media (prefers-reduced-motion: reduce) {
.ml-pbp__play { animation-name: ml-pbp-fade; }
.ml-pbp__play::before { animation: none; }
@keyframes ml-pbp-fade { from { opacity: 0; } }
}
