A terminal menu for your node.

  • menu

Downloads in past


400.2.57 years ago9 years agoMinified + gzip package size for menu in KB


menu #
A cli menu for your node.

Install ##

build alt platform alt
npm install menu


API ##


Menu is built around tabs.

There are currently four types:
Toggle: This tab functions like a button. List: This tab selects a single value from its list. Search: This tab takes a string input, and has the function of a list tab. Select: This tab creates a selectable drop-down list.
These tabs are declared as such...
var content = {
	tab1: {title:"column1", seltitle: "COLUMN1", type:"toggle", val:"true", color:"blue"},
	tab2: {title:["column2", "column22"], seltitle: ["COLUMN2", "COLUMN22"], type:"search", input: 0, val:"abcdefgh", color:"red"},
	tab3: {title:"column3", seltitle: "COLUMN3", type:"list", input: 0, val:["a", "b", "c"], color:"white"},
	tab4: {title:"column4", seltitle: "COLUMN4", type:"select", input: 0, val:["1","2","3","4","5","6"], color:"green"}


title: This is the tabs label when it's not focused.
seltitle: This is the tabs label when it is focused.
type: This is the tab's type.
input: This is the index value for a list, select, and search tabs.
val: For type toggle, it's a boolean value. For types list and select, it's an array of values. For type search it's a string.
color: The tab's set color. Look at the node clivas for all possible values.


var menu = require('./index.js');


menu.draw()							//this draws the headers

	menu.clivas							//you can custom draw with clivas


function work() {
    menu.start(options, function(result) {
        var key = result[0]; 						//refer to node keypress for all properties
        var column = result[1]; 					//the focused tab
        menu.draw();								//draw tabs
        if("return" && === 4) {			
				menu.clivas.line(Math.abs(column.input%column.val.length));	//always mod your column input to determine focused index
			} else if("return" && === 2) {
				menu.clivas.line("You searched for "+column.val);
				column.val = "";
			} else if(key.ctrl && ==="c") {
			} else if( ==="backspace") {
			} else if( ==="left") {
			} else if( ==="up") {
			} else if( ==="down") {
			} else if( ==="right") {
			} else {
			if( === 1) {					//use tab 1 to toggle tab 4's select contents
				if(column.val) {
					menu.columns["tab4"].val = ["z","y","x","w"];
				} else {
					menu.columns["tab4"].val = ["1","2","3","4","5","6"];
} work();