🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

@clack/prompts

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@clack/prompts

Effortlessly build beautiful command-line apps 🪄 [Try the demo](https://stackblitz.com/edit/clack-prompts?file=index.js)

0.10.1
latest
Source
npm
Version published
Weekly downloads
1.2M
9.81%
Maintainers
1
Weekly downloads
 
Created

What is @clack/prompts?

@clack/prompts is an npm package designed to facilitate the creation of interactive command-line prompts. It provides a variety of prompt types to gather user input in a streamlined and user-friendly manner.

What are @clack/prompts's main functionalities?

Text Prompt

This feature allows you to prompt the user for a text input. The example code asks the user for their name and then greets them.

const { text } = require('@clack/prompts');

(async () => {
  const name = await text({
    message: 'What is your name?'
  });
  console.log(`Hello, ${name}!`);
})();

Select Prompt

This feature allows you to present a list of options for the user to select from. The example code asks the user to choose a color from a list of options.

const { select } = require('@clack/prompts');

(async () => {
  const color = await select({
    message: 'Choose a color',
    choices: [
      { title: 'Red', value: 'red' },
      { title: 'Green', value: 'green' },
      { title: 'Blue', value: 'blue' }
    ]
  });
  console.log(`You chose ${color}.`);
})();

Confirm Prompt

This feature allows you to ask the user a yes/no question. The example code asks the user if they want to continue and logs a message based on their response.

const { confirm } = require('@clack/prompts');

(async () => {
  const proceed = await confirm({
    message: 'Do you want to continue?'
  });
  console.log(proceed ? 'Continuing...' : 'Operation aborted.');
})();

Password Prompt

This feature allows you to securely prompt the user for a password. The example code asks the user to enter their password and logs a confirmation message.

const { password } = require('@clack/prompts');

(async () => {
  const secret = await password({
    message: 'Enter your password:'
  });
  console.log('Password received.');
})();

Other packages similar to @clack/prompts

Keywords

ask

FAQs

Package last updated on 08 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts