Inquirer.js icon indicating copy to clipboard operation
Inquirer.js copied to clipboard

Feat: @inquirer/prompts checkbox support children

Open 3z3qu13l opened this issue 10 months ago • 1 comments

When using checkbox, being able to set choice.childrens.

Usage proposal:

await checkbox({
        message: 'Select domains to deploy',
        choices: [
            {
                name: 'snacks',
                value: 'SNACKS',
                childrens: [
                    { name: 'chips', value: 'CHIPS' },
                    { name: 'donuts', value: 'DONUTS' },
                ],
            },
            {
                name: 'burgers',
                value: 'BURGERS',
                childrens: [
                    { name: 'Big Mac', value: 'BIGMAC' },
                    { name: 'Double Chees', value: 'DOUBLE_CHEESE' },
                ],
            },
        ]
});

I was using that one in the past but it is no longer compatible with the latest releases: https://github.com/insightfuls/inquirer-tree-prompt

Example: Image

3z3qu13l avatar Feb 20 '25 16:02 3z3qu13l

Hi, thanks for reaching out!

Quickly looking at the download stats of the tree prompts on Github, I don't think it is a pattern with enough usage to warrant including within the core.

Though that's why the modern version of Inquirer ship with an easy to build upon API, and a whole testing framework. I'd encourage you to implement a custom community prompt, and adding it to the repo README! Doc on building custom prompt is here

SBoudrias avatar Feb 21 '25 20:02 SBoudrias