Terminal replay
A terminal session played back: each command typed at the prompt, its output line by line, the screen following the last line — or the whole session at rest, as the server renders it.
- Domaine
- Médias
- Niveau de support
- Taille
- 4.0 kB gzip, budget 2.6 kB
- Qui l'utilise
- 1 fichiers des produits et sites en production l'importent Compté dans l'inventaire daté du 2026-11-23.
import { TerminalReplay } from "@krizaka/ui/terminal-replay";Web uniquement — React, depuis @krizaka/ui/terminal-replay. Stable : son API ne change qu’à une version majeure.
- Mobile · n/a. A recorded terminal session shown on a site's page.
- Bureau · n/a. A public site's page, not a window of the Mac app.
Pourquoi il est là. agents.krizaka.com's console: real, sanitised agent log lines replayed as proof (krizaka-internal#4338, #4184).
Quand l’utiliser
- Show how a command-line tool works from a recording of a real session: install, start, run.
- A getting-started page where the reader should see the order of the commands and what each one answers.
Quand ne pas l’utiliser
- For commands the reader copies and runs, with nothing to watch.À la place : Kbd
- For a video of an application's screens: record the screens, not a terminal.À la place : Video player
- For output you wrote by hand: replay what the tool really printed, or show none.
Installation
Installer
npm install @krizaka/ui @krizaka/tailwind @krizaka/tokens tailwindcssStyles
@import "tailwindcss";
@import "@krizaka/tailwind";
@import "@krizaka/ui/tailwind.css";Importer
import { TerminalReplay } from "@krizaka/ui/terminal-replay";Exemples
A session
Three commands typed one after the other, their output line by line; it starts when it scrolls into view.
At rest
autoPlay={false}: the whole session is shown until the reader presses play — a page that should stay still.
Props
A terminal session played back: commands typed at the prompt, their output line by line — or the whole session at rest.
| Prop | Type | Défaut | Description |
|---|---|---|---|
labelrequis | string | — | The accessible name of the screen (“Terminal session: install, start, dev”) — passed translated. |
pauseLabelrequis | string | — | The pause button's words (the replay is running). |
playLabelrequis | string | — | The play button's words (the replay is waiting or paused). |
replayLabelrequis | string | — | The replay button's words (the session is shown whole). |
stepsrequis | readonly TerminalStep[] | — | The session, in order. |
autoPlay | boolean | true | Plays the first time it scrolls into view. false: the session rests whole until the reader presses play. |
copiedLabel | string | — | What the copy button says once the commands are copied (announced politely). |
copyLabel | string | — | The copy button's words: it copies the commands, one per line. Without it, no copy button. |
lineDelay | number | 70 | Milliseconds between two output lines. |
prompt | string | $ | What the prompt shows before each command. |
rows | number | 18 | The screen's height, in lines; longer sessions scroll. |
speed | number | 1 | A multiplier on every delay (the motion vocabulary's speed): 2 plays twice as fast, 0.5 half as fast. |
stepDelay | number | 900 | Milliseconds between a command's last line and the next command. |
title | ReactNode | — | The window's title, shown in its bar (~/projects — zsh). |
typingSpeed | number | 34 | Milliseconds per typed character. |
Accessibilité
- The screen is a named region holding the whole transcript for assistive technology; the characters being typed are hidden from it — never read letter by letter.
- It starts when it scrolls into view and waits while it is off screen; a control pauses it, plays it or replays it (WCAG 2.2.2).
- Under
prefers-reduced-motion, without JavaScript and before it plays, the whole session is shown at rest; the caret does not blink. - The copy button says it copied in a polite live region.
Clavier
| Touches | Action |
|---|---|
| Tab | Focuses the play, pause or replay control, the copy button, then the screen, which scrolls with the arrow keys. |
Bonnes pratiques
- Replay a real session, captured from the tool itself — never an invented output.
- Keep each step short: a long output is trimmed where it repeats, and says it was trimmed.
- Name the screen (
label) by what it shows; the words of the controls arrive as props, translated. - Give the copy button (
copyLabel) when the commands are meant to be run.
Composants liés
Générée depuis le code de @krizaka/ui 5.3.4 : son meta.ts, ses exemples et ses types.Modifier cette documentation sur GitHub