Skip to content
Effects

Terminal

A fake shell session that types itself.

import
import { Terminal } from '@joshicodes/cock';

Session

~/farm
$ bun run count-flock
Coop 1  ......  6 hens
Coop 2  ......  6 hens
Rooster ......  on the roof again
12 of 12 accounted for

Behaviour

  • Reserves the height of every line up front, so the box does not grow while it types.
  • Waits until it scrolls into view unless `startOnView` is false.
  • Screen readers get the finished text, not the animation.

API

Read out of the component sources at build time, so it matches the version you installed. Every component also takes class, merged through tailwind-merge so your utility wins.

Props of Terminal

PropTypeDefault
lines required
TerminalLine[]—
title

Shown in the bar above the output, e.g. a working directory.

string—
prompt
string'$'
speed

Milliseconds per typed character.

number45
lineDelay

Default pause between lines.

number300
loop

Start over a few seconds after the last line.

booleanfalse
startOnView

Wait until the terminal scrolls into view.

booleantrue
class
string—

See also

cock. Yes, it stands for core component kit. We checked twice.