@inquirer/checkbox

Interactive checkbox prompt for selecting multiple options in CLI

npmmacoslinuxwindows
Try with needOr install directly
Source

About

Inquirer checkbox prompt

Examples

let user select multiple items from a list$ import { checkbox } from '@inquirer/checkbox'; const answer = await checkbox({ message: 'Select items', choices: [{name: 'Option 1', value: '1'}, {name: 'Option 2', value: '2'}] });
show checkboxes with default selections already checked$ import { checkbox } from '@inquirer/checkbox'; const answer = await checkbox({ message: 'Pick features', choices: [{name: 'Feature A', value: 'a', checked: true}, {name: 'Feature B', value: 'b'}] });
create checkbox prompt with validation$ import { checkbox } from '@inquirer/checkbox'; const answer = await checkbox({ message: 'Select at least one', choices: [...], validate: (ans) => ans.length > 0 || 'Pick something' });
display checkbox menu with grouped categories$ import { checkbox } from '@inquirer/checkbox'; const answer = await checkbox({ message: 'Choose', choices: [{type: 'separator'}, {name: 'Group 1 Item', value: 'g1'}, {type: 'separator'}, {name: 'Group 2 Item', value: 'g2'}] });
build interactive CLI tool that selects multiple values$ import { checkbox } from '@inquirer/checkbox'; const selected = await checkbox({ message: 'What to install?', choices: ['npm', 'git', 'docker'].map(x => ({name: x, value: x})) });