Checkbox prompt with filterable input for inquirer
npm install inquirer-checkbox-searchThis is a prompt with user input search functionality made for inquirer.
Inspired by the checkbox prompt included in the inquirer core and inquirer-autocomplete-prompt.
Note: At the time of writing, this prompt has not been thoroughly vetted and tested, but currently serves the purpose it was originally written for. Contributions welcome.
```
npm install --save inquirer-checkbox-search
This prompt is anonymous, meaning you can register this prompt with the type name you please:
`javascript`
inquirer.registerPrompt('checkbox-search', require('inquirer-checkbox-search'));
inquirer.prompt({
type: 'checkbox-search',
...
})
Change checkbox-search to whatever you prefer.
This prompt is essentially a hybrid between inquirer checkbox and inquirer-autocomplete-prompt. See each Readme for available options, excluding suggestOnly.
`javascript`
inquirer.registerPrompt('checkbox-search', require('inquirer-checkbox-search'))
inquirer.prompt([{
type: 'checkbox-search',
name: 'states',
message: 'Which states would you like to visit?',
source: (answersSoFar, input) => {
return myApi.searchStates(input)
}
}]).then(answers => {
// etc
})
See example.js for a working example.
/down arrows to navigate the current list. Begin typing to filter the list results. The items selected in the filtered list persist through all searches.Use the
right arrow to make a selection. Use shift+right arrow to select all items or control+right arrow to inverse all items in either the original or filtered search list. Press enter` when finished with your selection.