Terminal

A command line for developer docs that types its commands, prints their output line by line, and copies the commands in one press.

Examples

Install a component

Install
npx shadcn@latest add https://ui.ndekocode.dev/r/motion-marquee.json
Checking registry
Installing dependencies
Created 1 file
components/motion/marquee.tsx

Deploy log

Deploy log
pnpm build
Compiled in 4.2s
Generated 38 static pages
harbor deploy --prod
Uploading 214 files
2 images are larger than 1 MB
Live at https://field-notes.example.com

Installation

npx shadcn@latest add https://ui.ndekocode.dev/r/motion-terminal.json

Component API

Terminal

PropTypeDefaultDescription
linesTerminalLine[]The session, in order: commands are typed, output lines are printed.
titlestring'Terminal'The label at the top left.
promptstring'$'The prompt shown before each command, in the muted colour.
typingSpeednumber32Milliseconds per typed character.
outputDelaynumber120Milliseconds before the next line when an output line has no delay of its own.
classNamestringOptional CSS class for the card.

TerminalLine

FieldTypeDescription
kind'command' | 'output'A command is typed after the prompt; an output line prints at once.
textstringThe line. A long line scrolls sideways.
tone'default' | 'muted' | 'success' | 'warning' | 'error'Output only: the status colour of the line.
delaynumberOutput only: milliseconds before the next line, for a slow step.

The session plays once when half of it is on screen, and the replay button plays it again. Every line keeps its place from the start, so the card never grows while it types. The whole session is in the page from the first render, so screen readers and text selection get every line. Under reduced motion the session shows complete, the caret stops blinking and the replay button is hidden.

The typing relies on a monospaced font, which the card sets with font-mono.

Credits

The effect is inspired by the terminal of UI Layouts, built as a working docs component.