Skip to content

Function interactiveListPrompt() ​

interactiveListPrompt(config: InteractiveListConfig): Promise<string>

Source: interactiveListPrompt.ts

Creates an interactive list of choices that supports selection via arrow keys + enter or via pressing a key associated with a choice.

This is based on pgibler/inquirer-interactive-list-prompt.

Parameters ​

config ​

InteractiveListConfig

Returns ​

Promise<string>

Example ​

ts
const answer = await interactiveListPrompt({
  message: "Select an option:",
  choices: [
    { name: "Option A", value: "A", key: "a" },
    { name: "Option B", value: "B", key: "b" },
    { name: "Option C", value: "C", key: "c" },
  ],
});

Built by Prozilla