Giter VIP home page Giter VIP logo

inquirer-checkbox-search's Introduction

inquirer-checkbox-search

This 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.

Installation

npm install --save inquirer-checkbox-search

Usage

This prompt is anonymous, meaning you can register this prompt with the type name you please:

inquirer.registerPrompt('checkbox-search', require('inquirer-checkbox-search'));
inquirer.prompt({
  type: 'checkbox-search',
  ...
})

Change checkbox-search to whatever you prefer.

Options

This prompt is essentially a hybrid between inquirer checkbox and inquirer-autocomplete-prompt. See each Readme for available options, excluding suggestOnly.

Example

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.

Keybindings

Use the up/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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.