termprompt

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.

Featuretermprompt
Promptsselect, confirm, input, multiselect, password, search
Displayintro, outro, spinner, log, note
ThemingsetTheme({ accent: '#7c3aed' }) - hex, RGB, named, or custom function
DependenciesZero. Only Node.js built-ins.
TypeScriptStrict types, generics, typed cancel handling
CancelSymbol-based. No confusion with falsy values.
KeyboardArrow keys, vim bindings (j/k/h/l), Ctrl shortcuts
OSC 7770Smart terminals can intercept and render native UI
Compositiongroup() chains prompts with shared state
BundleUnder 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

bash
create-app
Pick a framework
Next.js (React SSR)
○ Hono (Edge-first)
○ Astro (Content-first)

Smart terminal host

your-terminal.dev

Pick a framework

Next.jsReact SSR
HonoEdge-first
AstroContent-first

Your CLI doesn't need to know which one it's running in. Write prompts once, get native UI for free.

Explore

On this page