Skip to content

Feat: @inquirer/prompts checkbox support for different name when selected #1647

@puco

Description

@puco

When using checkbox I would like to show more information in the name when a user selects an option. This information is quite expensive to retrieve, so I would only want to do it on selection. The feature should also support Promises to update the name of the Choice. Or this can be solved using events, which also could be exposed.

usage proposal:

const choices = await checkbox(
  message: "Select modules",
  choices: choice
    .map(({ name, value, key }) => ({
      name
      value,
      onChecked: async () => ({ name: `${name} - ${await getData(key)}` })
    }))

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions