inquirer
Inquirer.js is a collection of common interactive command-line user interfaces for Node.js, providing prompts for gathering input from users in terminal applica…
Installation
npm install inquirer
yarn add inquirer
pnpm add inquirer
Import
import inquirer from 'inquirer';
Quick Example
import inquirer from 'inquirer';
const answers = await inquirer.prompt([
{ type: 'input', name: 'name', message: 'Project name:' },
{ type: 'list', name: 'lang', message: 'Language:', choices: ['TypeScript', 'JavaScript'] },
{ type: 'confirm', name: 'git', message: 'Init git?' },
]);About inquirer
Inquirer.js is a collection of common interactive command-line user interfaces for Node.js, providing prompts for gathering input from users in terminal applications. The library supports multiple prompt types including input (free text), confirm (yes/no), list (single selection from choices), checkbox (multiple selection), password (masked input), editor (opens system text editor), number, and rawlist. Each prompt can be configured with validation functions that check user input and return error messages, filter functions that transform answers, default values, conditional display using when functions, and custom formatting. Inquirer handles terminal raw mode for interactive features, cursor manipulation for rendering choices, keyboard navigation with arrow keys, and search/filter within long lists. The library supports prompt chaining where later prompts can reference earlier answers, and provides a modular architecture where individual prompt types can be imported separately. Inquirer is used by major CLI tools including Yeoman generators, Angular CLI, Netlify CLI, and create-react-app for interactive project scaffolding. The library provides a streaming interface for programmatic answer injection during testing.
Quick Facts
| Package | inquirer |
| Category | Utility |
| Weekly Downloads | 10M+ |
| License | MIT |
| Install | npm install inquirer |
Related Packages
Commander is the most popular library for building command-line interfaces in Node.js, providing a f…
Yargs is a feature-rich library for building interactive command-line tools by parsing arguments, ge…
Chalk is the most popular library for styling terminal string output with colors and formatting in N…
Ora is an elegant terminal spinner library for Node.js that provides visual feedback during long-run…
Browse npm Packages by Category
Explore our reference of 200 popular npm packages with install commands, examples, and quick-start guides.