browser-menu
v1.0.1
Published
A browser-friendly implementation of substack's terminal-menu
Downloads
74
Maintainers
Readme
browser-menu
A browser-friendly implementation of substack's terminal-menu module:
Usage
The API is more or less equivalent to terminal-menu:
menu = createMenu(opts)
Create a menu with opts
:
opts.width
- menu width inem
opts.x
- top-left corner x offset, default: 1opts.y
- top-left corner y offset, default: 1opts.fg
- foreground color, default: 'white'opts.bg
- background color, default: 'blue'opts.padding.left
- left padding inem
opts.padding.right
- right padding inem
opts.padding.top
- top padding inem
opts.padding.bottom
- bottom padding inem
The menu can be driven around with the arrow keys and j/k, vi-style. To quit out
of the menu, hit ^C
or q
.
menu.add(label)
Create a new selectable menu item with the string label
.
menu.write(msg)
Write a message to the menu.
menu.reset()
Adds the menu to the document. You can also do this yourself, as
menu.element
points to the DOM node for the menu.
menu.close()
Unregister all listeners and bring everything back to its original state.
License
MIT. See LICENSE.md for details.