TerminalOutput

Streaming shell output with ANSI colours, a copy button, folding for long output and a closing exit code. AI.

Open playground
$ npx vitest run
vitest run
✓ src/tax.test.ts (12 tests)
✓ src/invoice.test.ts (31 tests)
✗ src/refund.test.ts (9 tests)
AssertionError: expected 64 to equal 64.01
Tests 1 failed | 51 passed
Running

About

TerminalOutput is a React component in the AI category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { TerminalOutput } from "@ashutoshswamy/smoui" and set command, output, exitCode among its 5 props.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { TerminalOutput } from "@ashutoshswamy/smoui";

<TerminalOutput command="npm test" output={text} exitCode={0} />

Props 5

command

Shown in the header.

string
output

Raw output. ANSI colours and bold are read.

string
exitCode

Set once finished.

number
running

Shows a spinner and keeps the latest output in view.

boolean
maxLines

Lines before Show all. Defaults to 12.

number