
Inquirer.js Has a Free API — Here's How to Build Interactive CLI Prompts
Inquirer.js is a collection of interactive CLI prompts. It handles text input, selections, confirmations, checkboxes, and password inputs — making your CLI tools feel professional. Installation npm install @inquirer/prompts Basic Prompts import { input , select , confirm , checkbox , password } from " @inquirer/prompts " ; // Text input const name = await input ({ message : " What is your name? " }); // Select one option const framework = await select ({ message : " Choose a framework: " , choices : [ { name : " React " , value : " react " }, { name : " Vue " , value : " vue " }, { name : " Svelte " , value : " svelte " }, { name : " Angular " , value : " angular " } ] }); // Confirm const proceed = await confirm ({ message : " Continue? " , default : true }); // Multiple selection const features = await checkbox ({ message : " Select features: " , choices : [ { name : " TypeScript " , value : " ts " , checked : true }, { name : " ESLint " , value : " eslint " }, { name : " Prettier "
Continue reading on Dev.to JavaScript
Opens in a new tab

