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
- Home: the heroEach role edits its own line: the cursor smears to it, deletes a word and types the next.
Installation
- Get runets.
git clone https://github.com/ziyam-khan/runets - Copy these files into your project, keeping their folders.
- Install what they use.
pnpm add react - 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
| Prop | Type | What it does |
|---|---|---|
TerminalLines lines | { pre, word, post?, widest? }[] | The lines; widest sizes a line for its longest word. |
TerminalLines active / edit / caret | number / string / Ref | The 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 / busy | Ref / boolean | The cell to follow; busy stops the blink while typing. |
SmearCursor lead / trail / curve | number | Per-frame pull of the nearest and farthest corners and the curve between (0.6, 0.3, 2). |
Accessibility
- The lines are aria-hidden: give the window a readable list or label of what they say.
- Reduced motion moves the cursor without a smear.
- Typing pauses when run is false and the word finishes at once.
Source
The code is in src/kit/terminal.tsx in runets, MIT licensed.