Work 06 / Developer utility

ink-prompt

A focused prompt toolkit for interactive terminal applications built with Ink.

View source TypeScript

A React Ink component library focused on terminal-friendly prompts. The first export is MultilineInput, an Ink component for collecting multi-line text input in command-line interfaces.

Features

  • Multi-line Text Input: Full-featured text editor for CLIs
  • Rich Editing Controls:
    • Arrow keys for navigation
    • Ctrl+J or \ before Enter to add newlines
    • Ctrl+Z/Ctrl+Y for undo/redo
    • Enter to submit the buffer
  • Customizable Width: Configure input width to fit your terminal
  • Seamless Ink Integration: Works naturally with other Ink components
  • TypeScript Support: Full type definitions included

Installation

npm install ink-prompt

Usage

import React from 'react';
import { render, Box, Text } from 'ink';
import { MultilineInput } from 'ink-prompt';

const App = () => {
  return (
    <Box flexDirection="column">
      <Text>Describe your change (press Enter to submit):</Text>
      <MultilineInput
        onSubmit={(value) => console.log(value)}
        width={80}
      />
    </Box>
  );
};

render(<App />);

Use Cases

  • Building interactive CLI tools that need text input
  • Creating terminal-based forms and prompts
  • Collecting commit messages, descriptions, or notes
  • Gathering code snippets or configuration in CLIs
  • Any application needing rich text input in the terminal

About Ink

Ink is a React renderer for building command-line interfaces. It allows you to use React components and JSX to build interactive CLI applications with a familiar development experience. This library extends Ink’s capabilities with terminal-friendly input prompts.

Tech Stack

  • TypeScript
  • React 18/19
  • Ink 5/6
  • Vitest for testing

Development

npm install       # Install dependencies
npm run build     # Build the project
npm run dev       # Watch for changes
npm run type-check # Type checking

Check out the GitHub repository for more examples and documentation.