JSPM

inquirer-select-with-banner

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 11
  • Score
    100M100P100Q53080F
  • License MIT

Package Exports

  • inquirer-select-with-banner
  • inquirer-select-with-banner/package.json

Readme

inquirer-select-with-banner

screen recording of cli

An Inquirer.js select prompt that displays a dynamic banner above the choices, updating as the user navigates through options.

Inspired by inquirer-select-with-state, the core difference being that the banner function is given what the user is currently hovering on, allowing for context aware information to be shown.

Installation

npm install inquirer-select-with-banner

Usage

import { select } from 'inquirer-select-with-banner';

const answer = await select({
  message: 'Choose your weapon',
  choices: [
    { value: 'axe', name: 'Battle Axe' },
    { value: 'sword', name: 'Sword' },
    { value: 'bow', name: 'Bow and Arrow' }
  ],
  banner: (choice) => `Selected: ${choice.name}` // <- Controls the banner. return `string` to display, `undefined` or '' to clear, `null` to preserve the previous banner 
});

The return value of the banner function should be a string that controls what the banner displays. If you want the banner to not update, you can pass null to have it reuse the previous selection's banner.