termprompt
Beautiful terminal prompts for Node.js. Zero dependencies, brand theming, OSC 7770 protocol support.
termprompt
Beautiful terminal prompts for Node.js CLIs.
Why termprompt?
Most prompt libraries are either bloated with dependencies, locked to a fixed look, or abandoned. termprompt gives you polished interactive prompts with zero runtime dependencies, brand theming in one line, and a protocol layer that lets smart terminals render native UI.
| Feature | termprompt |
|---|---|
| Prompts | select, confirm, input, multiselect, password, search |
| Display | intro, outro, spinner, log, note |
| Theming | setTheme({ accent: '#7c3aed' }) - hex, RGB, named, or custom function |
| Dependencies | Zero. Only Node.js built-ins. |
| TypeScript | Strict types, generics, typed cancel handling |
| Cancel | Symbol-based. No confusion with falsy values. |
| Keyboard | Arrow keys, vim bindings (j/k/h/l), Ctrl shortcuts |
| OSC 7770 | Smart terminals can intercept and render native UI |
| Composition | group() chains prompts with shared state |
| Bundle | Under 10 KB gzipped |
Quick Start
import { intro, outro, select, isCancel, log } from 'termprompt';
intro('my-cli');
const lang = await select({
message: 'Pick a language',
options: [
{ value: 'ts', label: 'TypeScript' },
{ value: 'js', label: 'JavaScript' },
{ value: 'go', label: 'Go' },
],
});
if (isCancel(lang)) {
log.warn('Cancelled.');
process.exit(0);
}
log.success(`Selected: ${lang}`);
outro('Done.');
Smart Terminal Hosts
Same code, two experiences. In a standard terminal, users get the text-based TUI. In a smart terminal host (web UI, custom emulator, multiplexer), the host intercepts OSC 7770 escape sequences and renders native UI instead.
Standard terminal
┌ create-app│◇ Pick a framework│ ◉ Next.js (React SSR)│ ○ Hono (Edge-first)│ ○ Astro (Content-first)└
Smart terminal host
Pick a framework
Your CLI doesn't need to know which one it's running in. Write prompts once, get native UI for free.
Explore
Getting Started
Install, first prompt, and project setup.
Theming
Brand your prompts with hex, RGB, or any color.
Prompts
select, confirm, input, multiselect, password, search.
Spinner
Animated loading indicator for async operations.
Log & Display
Structured logging, intro/outro markers.
Note
Boxed notes with optional titles.
Group
Chain prompts into form-like workflows.
Cancel Handling
Type-safe cancellation with symbol-based checking.
OSC 7770 Protocol
How smart terminals can intercept prompts.