Created
December 2, 2015 22:32
-
-
Save mbroadst/ba09bf5089e11a99ffb2 to your computer and use it in GitHub Desktop.
idea/desire for box layouts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var blessed = require('blessed'); | |
var form = blessed.form({ width: 200, height: 200 }); | |
var formLayout = blessed.boxlayout({ direction: 'vertical' }); | |
formLayout.append(blessed.label({ content: 'Name:' })); | |
formLayout.append(blessed.textbox({ name: 'name' })); | |
formLayout.append(blessed.label({ content: 'Birthday:' })); | |
formLayout.append(blessed.textbox({ name: 'birthday' })); | |
formLayout.append(blessed.line({ direction: 'horizontal' })); | |
var buttonLayout = blessed.boxLayout({ direction: 'horizontal' }); | |
buttonLayout.addStretch(); | |
buttonLayout.append(blessed.button({ name: 'cancel', /* ... */ })); | |
buttonLayout.append(blessed.button({ name: 'submit', /* ... */ })); | |
formLayout.appendLayout(buttonLayout); | |
/* | |
This would generate a form that looked sort of like this: | |
|-------------------------------| | |
| Name: | | |
| [ ] | | |
| | | |
| Birthday: | | |
| [ ] | | |
| _____________________________ | | |
| | | |
| [cancel] [submit] | | |
|-------------------------------| | |
*/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment