Terminal

Prompt lines that retype their own words while a block cursor smears from line to line, like smear-cursor in Neovim.

Features

  • Four parts: TerminalWindow (panel and title bar), TerminalLines (prompt lines with one changing word), useRetype (backspace, pause, type at an uneven pace) and SmearCursor.
  • The cursor is one clip-path polygon whose corners each chase their spot, the nearest fastest, so a jump leaves a tapering smear and a keystroke steps one crisp cell.
  • Every line keeps an unseen copy of its widest version, so the block never reflows while it types.
  • Render the lines on the server and load the typing later: the static lines carry their own caret.

Use it for

  • A hero that says several things in turn.
  • Changelogs, command demos, onboarding.

On this site

Installation

  1. Get runets.
    git clone https://github.com/ziyam-khan/runets
  2. Copy these files into your project, keeping their folders.
  3. Install what they use.
    pnpm add react
  4. Load the styles once. Bring your own base tokens, or use runets’ default theme.
    import 'runets/styles/theme.css'
    import 'runets/styles/kit.css'

API

PropTypeWhat it does
TerminalLines lines{ pre, word, post?, widest? }[]The lines; widest sizes a line for its longest word.
TerminalLines active / edit / caretnumber / string / RefThe line being edited, its text mid-edit and the caret element the cursor follows.
useRetype(id, from, to, run){ text, busy }A new id starts an edit; run false finishes it at once.
SmearCursor target / busyRef / booleanThe cell to follow; busy stops the blink while typing.
SmearCursor lead / trail / curvenumberPer-frame pull of the nearest and farthest corners and the curve between (0.6, 0.3, 2).

Accessibility

Source

The code is in src/kit/terminal.tsx in runets, MIT licensed.