## Usage ```js var UI = require('{%= name %}'); var ui = new UI(); ``` ## Example ![example](example.gif) The following example shows how to create a basic input prompt. This example is a greatly simplified version of [prompt-base][]. _(This code is also in [example.js](example.js) if you want to run it yourself.)_ ```js var cyan = require('ansi-cyan'); var UI = require('{%= name %}'); var ui = new UI(); // first, we need to render the "question" // to display in the terminal var prompt = '? foo '; ui.render(prompt); // on keypress events, re-render the prompt // along with user input ui.on('keypress', function() { ui.render(prompt + ui.rl.line); }); // when the "line" event is emitted (from the "enter" keypress) // we `.end()` to unmute the output stream then pause the readline. ui.on('line', function(answer) { ui.render(prompt + cyan(answer)); ui.end(); ui.rl.pause(); console.log({color: answer}); }); ``` ## API {%= apidocs("index.js") %} ## Attribution Inspired by the "screen manager" code in Inquirer.