JSPM

  • Created
  • Published
  • Downloads 2550965
  • Score
    100M100P100Q194490F
  • License MIT

Easy list UI for your CLI app

Package Exports

  • ky

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ky) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

ky Build Status

Easy list UI for your CLI app

Install

$ npm install ky

Usage

var chalk = require('chalk');
var List = require('ky');

var items = [
    {id: 'foo', title: 'Ponies'},
    {id: 'bar', title: 'OMG NO', disabled: true},
    {id: 'baz', title: 'javaSCript'},
    {id: 'bal', title: 'Some Highlander Whiz'}
];

var list = new List(items, {
    header: chalk.bgYellow.black('Unicorns & rainbows'),
    footer: 'IAMA FOOTER'
});

list.init();

list.on('keypress', function (key, selected) {
    if (key.name === 'return') {
        list.header = require('chalk').red('Candy??');
        list.render();
    }
});

list.on('change', function () {
    list.header = 'change';
});

License

MIT © Sindre Sorhus