terminal-i2
Advanced tools
Comparing version 1.1.0 to 1.1.1
{ | ||
"name": "terminal-i2", | ||
"version": "1.1.0", | ||
"description": "", | ||
"version": "1.1.1", | ||
"description": "With this module you can create interactive menus in your terminal. Use the `createMenu` class provided by the module for this. This is a first version and we will add other functionalities.", | ||
"type": "module", | ||
@@ -6,0 +6,0 @@ "main": "./dist/index.js", |
# Terminal i2 | ||
## Description | ||
With this module you can create interactive menus in your terminal. Use the `Menu` class provided by the module for this. | ||
With this module you can create interactive menus in your terminal. Use the `createMenu` class provided by the module for this. | ||
This is a first version and we will add other functionalities. | ||
@@ -11,2 +11,51 @@ | ||
pnpm install terminal-i2 | ||
``` | ||
``` | ||
## Usage | ||
- Type of options menu | ||
- title: Title of the menu | ||
- options: Different options that the menu will have | ||
- markedOption: default option marked | ||
- colorTitle: color of the title | ||
- colorOption: color of the options | ||
- bgColorOption: color of the background of the options | ||
- colorOptionHover: color of the options when the selector is over | ||
- bgColorOptionHover: color of the background of the options when the selector is over | ||
![type-options-menu](image.png) | ||
- Example 1 | ||
```javascript | ||
import { createMenu } from 'terminal-i2';ç | ||
const menu = new createMenu({ | ||
colorTitle: 'red', | ||
bgColorOption: '', | ||
colorOption: 'white', | ||
bgColorOptionHover: 'bgYellow', | ||
colorOptionHover: 'red', | ||
}); | ||
const option = await menu | ||
.head(`[white]Titulo del menu[/white]`) | ||
.item("Opción 1", true) | ||
.item("Opción 2") | ||
.item("Opción 3") | ||
.render() | ||
``` | ||
- Example 2 | ||
```javascript | ||
import { createMenu } from 'terminal-i2'; | ||
const menu = new createMenu({ | ||
colorTitle: 'red', | ||
bgColorOption: '', | ||
colorOption: 'white', | ||
bgColorOptionHover: 'bgYellow', | ||
colorOptionHover: 'red', | ||
title: 'Titulo del menu', | ||
options: ['Opción 1', 'Opción 2', 'Opción 3'], | ||
markedOption: 1 | ||
}); | ||
const option = await menu.render() | ||
``` |
87995
17
61