Terminal
MotionReact animated terminal window that types commands and prints output lines in sequence, with colored line kinds, a blinking cursor and a replay button.
Installation
npx shadcn@latest add @minidev/terminal
MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/terminal.json
Usage
import { Terminal } from "@/components/ui/terminal"
export function Example() {
return (
<Terminal />
)
}
API reference
| Prop | Type | Default |
|---|---|---|
| lines | TerminalLine[] | SAMPLE_LINES |
| title | string | "Terminal" |
| promptPrompt printed before each command. | string | "❯" |
| typingSpeedMilliseconds per typed character. | number | 26 |
| lineDelayMilliseconds before each output line prints. | number | 160 |
| commandDelayMilliseconds before a command starts typing. | number | 600 |
| loopStart over after the last line, with a pause. | boolean | false |
| replayShow the replay button in the title bar. | boolean | true |
| appearanceStay dark in both themes, or follow the page theme. | "dark""auto" | "dark" |
| onCompleteCalled once the last line has printed. | () => void | - |
| className | string | - |
When to use
Use it to show an install command or CLI flow on a docs or launch page. Reach for the free TerminalWindow for a static transcript, CodeBlock for copyable code, and ConsoleOutput for streaming logs inside product UI.
Keyboard interactions
| Key | Action |
|---|---|
| Tab | Moves to the Replay button, the only focusable control. |
| EnterorSpace | On Replay, starts the transcript again from the first line. |
Accessibility
- The animated body is
aria-hidden. A screen-reader-only<pre>holds the whole transcript, with the prompt before each command, so it is read in full and never half-typed. - Under
prefers-reduced-motion: reduce, every line shows at once and no typing timers run.onCompletefires straight away. - The Replay button is labelled "Replay". Pass
replay={false}to remove it.
Frequently asked questions
When does the typing start?
When at least 30% of the window is on screen. It pauses when the window scrolls away and carries on where it left off. Set loop to start over 2.4 seconds after the last line, and onComplete fires each time the last line prints.
How do I control the timing of each line?
typingSpeed is ms per character (26), commandDelay is the pause before a command (600) and lineDelay the pause before each output line (160). Any line can override its own wait with delay.
Does it run commands or take input?
No. It plays the scripted lines you pass and has no input or copy button. For a static transcript use TerminalWindow, and for a command people should copy use CodeBlock.
Can it follow the light theme?
Yes. It stays dark in both themes by default; pass appearance="auto" to use the page's theme tokens instead.
Dependencies
npm
Built from
Examples
Deploy transcript
Commands type out and every other kind prints whole; error lines turn red and a per line delay adds a pause before a retry.
Light theme, looping
appearance="auto" follows the page theme; loop starts over after a pause and a faster typingSpeed suits short commands.
On complete
onComplete fires once the last line has printed, so the next step can unlock when the transcript is done.