Thinking UI

Terminal StreamPRO

A coding agent's terminal: commands, streamed output, a spinner while it runs and an exit badge when it's done.

Code

2 files · 478 lines of TypeScriptPRO

Terminal Stream is part of Pro

Get its source, the one-paste agent prompt and all 113 components, for a one-time $99.

Motion notes

  • New lines fade in from a soft blur with no vertical travel, so a fast log never jitters under the reader's eye.
  • Rows are a fixed 20px, so a finished block folds to its last N lines with plain maths. The result lives at the end of a log, so that's the part that stays visible.
  • The braille spinner steps instead of spinning: it reads as terminal-native and costs one text node. When the command ends it swaps for the exit badge on a micro spring.
  • Auto-scroll follows a ResizeObserver, so it keeps up with folds and unfolds as well as new lines. Scrolling up lets go and returning to the bottom picks it up again. With reduced motion, lines appear instantly and folds snap.

Usage

Example
<TerminalStream
    title="zsh — ~/app"
    running={status === "running"}
    lines={[
      { kind: "command", text: "npm test", exitCode: 0 },
      { kind: "output", text: " ✓ src/lib/format.test.ts (6 tests)" },
      { kind: "success", text: " Tests  42 passed (42)" },
    ]}
  />

Props

PropTypeDefaultDescription
linesTerminalLine[]—{ id?, kind: "command" | "output" | "error" | "info" | "success", text, exitCode? }. Each command starts a block; set exitCode on it once it finishes.
runningbooleanfalseThe last command is still running: spinner, caret, and its output never folds.
titlestring"Terminal"Title bar label, e.g. zsh — ~/app.
promptstring"$"Glyph shown before commands.
maxOutputLinesnumber6Finished output longer than this folds to its last N lines behind a toggle.
heightnumber280Max height of the scrolling pane, in px.
autoScrollbooleantrueFollow new output while the reader is at the bottom.
tintbooleantrueTint ✓, FAIL, warnings and timings inside output, like ANSI colors mapped to tokens.
onCopy(text: string) => void—Called with the whole transcript when copied.
classNamestring—Classes for the outer frame.