Skip to content
On this page

Prompt (experimental)

The prompt action can prompt the user for input when applying a preset.


Call the prompt options in the handler function:

export default definePreset({
  // ...
  handler: async () => {
    await prompt({ name: 'name', text: 'What is your name?' })



Defines the property name of the prompts context object in which the answer to the prompt will be stored.


Defines the text that will be displayed in the console when asking for input.


Defines the default value for the prompt if the answer is skipped or if the terminal is not interactive.


Ask for a project name and use the target directory's name as the default value

await prompt({
  title: 'prompt project name',
  name: 'name',
  text: 'What is the name of the project?',
  default: path.parse(context.applyOptions.targetDirectory).name,


interface PromptOptions {
  name: string;
  text: string;
  default?: string;
Prompt (experimental) has loaded