🛠️
Utility10M+/wkMIT

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
npm install inquirer
yarn
yarn add inquirer
pnpm
pnpm add inquirer

Import

ESM
import inquirer from 'inquirer';

Quick Example

usage
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

Packageinquirer
CategoryUtility
Weekly Downloads10M+
LicenseMIT
Installnpm install inquirer

Related Packages

Browse npm Packages by Category

Explore our reference of 200 popular npm packages with install commands, examples, and quick-start guides.