Inquirer
Collection of interactive command-line user prompts for Node.js with validation and rich UI.
Official Documentation ↗v8.7.5. Check the official docs for the latest API surface.Installation
npm install @inquirer/promptspnpm add @inquirer/promptsyarn add @inquirer/promptsMethods
No methods match this filter.
Inquirer is a collection of common interactive command-line user interfaces. The modern @inquirer/prompts package offers modular, individually importable prompts for input, select, checkbox, confirm, password, and more.
Key Features
- Rich prompts: Input, select, multi-select, confirm, password, editor
- Validation: Sync or async validate functions per prompt
- Keyboard UI: Arrow-key navigation and filtering
- Modular: Import only the prompts you use
- Custom prompts: Build your own with @inquirer/core
Errors
The following points are quoted verbatim from the official documentation. 来源:https://cdn.jsdelivr.net/gh/SBoudrias/Inquirer.js@latest/README.md · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:50:28.447Z. Any error type, throw condition or recovery step not stated there is left unspecified; this page does not infer exception classes or return values.
- Should return true if the value is valid, and an error message (String) otherwise. (https://cdn.jsdelivr.net/gh/SBoudrias/Inquirer.js@latest/README.md)
FAQ
- Which Inquirer package should I use?
- Use @inquirer/prompts for new projects: it is modular, tree-shakeable, and ESM-first. The legacy inquirer package still works but is a larger single object with a different API.
- How do I validate prompt input?
- Pass a validate function returning true or an error string. For async validation, return a Promise. The prompt re-asks until validate returns true.
- Can I create custom prompt types?
- Yes. Implement a prompt using @inquirer/core, which provides the readline, key handling, and rendering primitives. Many official prompts are built this way and can serve as templates.
Report a problem with this API docOpens a pre-filled issue on GitHub.