ink-prompt
v0.1.8
Published
A React Ink component for prompts
Downloads
662
Readme
ink-prompt
A React Ink component library focused on terminal-friendly prompts. The first
export is MultilineInput, an Ink component for collecting multi-line text in
CLIs.
Installation
npm install ink-promptUsage
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 />);MultilineInput supports typical editing controls:
- Arrow keys for navigation
Ctrl+Jor typing\before Enter to add a newlineCtrl+Z/Ctrl+Yfor undo/redo- Enter submits the current buffer
Development
# Install dependencies
npm install
# Build the project
npm run build
# Watch for changes
npm run dev
# Type check
npm run type-checkLicense
MIT
