StealThis .dev

Thinking Trace

A collapsible reasoning panel that mimics modern reasoning models — a live Thinking header with a running timer and shimmering placeholder while tokens stream in, then folds into a one-line summary the moment it finishes. Expand it to replay the full step-by-step chain of thought, watch the elapsed duration, and flip an auto-collapse switch so the trace tucks itself away automatically once reasoning completes.

Open in Lab
vanilla-js css
Targets: JS HTML

Code

Thinking Trace recreates the collapsible reasoning block you see in modern reasoning-model chat UIs. While the model is “thinking,” the header shows a pulsing brain icon, a shimmering skeleton line, and a live timer that ticks up in real time. Reasoning steps stream in one at a time with a soft fade, and once the model settles on an answer the block collapses to a compact summary such as Thought for 4.2s · 6 steps.

Click the header (or press Enter/Space) to expand and replay the entire chain of thought — each numbered step with its own label — then collapse it again to reclaim space. A toggle switch controls whether the trace auto-collapses the instant it finishes, mirroring the behavior of assistants that hide their scratchpad by default. A “Run again” control restarts the stream so you can watch the whole lifecycle repeat.

The demo is driven by requestAnimationFrame for the smooth, drift-free elapsed timer and by setTimeout-scheduled streaming to simulate token latency, with an animated grid-template-rows transition (and a max-height fallback) powering the collapse. Everything is vanilla JS and CSS — no libraries, no build step — and the whole widget is keyboard-operable with proper aria-expanded / aria-live semantics.