terminal-demo

Animated terminal demo component for showcasing CLI tools

How to use
Text Input
Preview

Features

Installation

npm install terminal-demo

CLI

Play terminal demos directly in your terminal with a simple markdown-like format

Basic Usage

# Play a scenario file
npx terminal-demo play demo.md
# With options
npx terminal-demo play demo.md --speed 2
# Record to asciinema .cast file
npx terminal-demo play demo.md --record output.cast

Options

  • --speed <n>Playback speed multiplier
  • --prompt <text>Custom prompt text
  • --symbol <char>Custom prompt symbol
  • --clearClear terminal before playing
  • --record <file>Record to asciinema .cast file

Recording Demos

Record terminal demos to asciinema .cast format for sharing or converting to GIF/SVG:

# Record a demo
npx terminal-demo play demo.md --record output.cast
# Convert to SVG with svg-term-cli
npx svg-term --in output.cast --out output.svg --window

Scenario Format

Write scenarios in a simple markdown-like format:

# my-demo
Demo description

---
$ npm install my-cli
[spinner:1500] Installing dependencies...
> [green]✓ Installed successfully[/green]
$ my-cli init
? Choose a template:
: typescript
> [cyan]Project created![/cyan]
$ — Command input
> — Output line
? — Question prompt
: — User answer
[spinner:ms] — Loading spinner
[wait:ms] — Pause

Quick Start

import { TerminalDemo } from 'terminal-demo'
import 'terminal-demo/style.css'

const demo = new TerminalDemo(element, {
  title: 'my-cli — zsh',
  scenarios: [
    {
      name: 'demo',
      steps: [
        { type: 'prompt' },
        { type: 'command', text: 'my-cli hello', delay: 60 },
        { type: 'output', text: '[green]Hello, World![/green]' },
      ]
    }
  ]
})

demo.play()

Get Started

Open source and free to use. MIT License.

Products

terminal-demo - Animated Terminal Demo Component