How to use the blessed.form function in blessed

To help you get started, we’ve selected a few blessed examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OpusCapita / fsm-workflow / packages / examples / invoice-console / forms.js View on Github external
const startForm = ({
  screen,
  formProperties = {},
  submitLabel = 'Start',
  onSubmit = () => {},
}) => {
  // console.log(`arguments[0]: '${JSON.stringify(arguments[0])}'`);
  const form = blessed.form({
    label: 'Action Form',
    mouse: true,
    keys: true,
    vi: true,
    left: 0,
    top: 0,
    width: "100%",
    scrollable: true,
    scrollbar: {
      ch: " "
    },
    border: 'line',
    ...formProperties
  });

  form.on("submit", onSubmit);
github astefanutti / kubebox / lib / ui / login.js View on Github external
function login_form(screen, kube_config, kubebox, { closable } = { closable: false }) {
  const form = blessed.form({
    name      : 'form',
    screen    : screen,
    keys      : true,
    clickable : true,
    left      : 'center',
    top       : 'center',
    width     : 53,
    height    : kube_config ? 9 : 7,
    shrink    : false,
    border    : { type : 'line' },
  });
  // retain key grabbing as text areas reset it after input reading / blurring
  form.on('focus', () => form.screen.grabKeys = true);

  form.on('element keypress', (el, ch, key) => {
    // submit the form on enter for textboxes
github heapwolf / lev / lib / ui / connections.js View on Github external
}
    },
    left: 'center',
    top: '15%',
    width: '70%',
    height: 21
  })

  // screen.on('keypress', function(ch, key) {
  //   if (connections.visible && key.name == 'escape') {
  //     connections.hide()
  //     screen.render()
  //   }
  // })

  var form = blessed.form({
    parent: connections,
    mouse: true,
    keys: true,
    vi: true,
    bg: 'white',
    fg: 'black',
    left: 1,
    right: 1,
    top: 1,
    bottom: 3
  })

  var list = connections._.list = blessed.list({
    parent: form,
    mouse: true,
    keys: true,
github bkanber / Slackadaisical / src / MessageForm.js View on Github external
constructor(channel) {
        this.channel = channel;
        this.screen = this.channel.screen;
        this.api = this.channel.api;

        this.form = blessed.form({
            parent: this.channel.box,
            keys: true,
            left: 0,
            bottom: 0,
            width: '100%-2',
            height: 4,
            // border: {type: 'line'}
        });

        this.textbox = blessed.textbox({
            parent: this.form,
            left: 0,
            top: 0,
            width: '100%',
            height: 4,
            input: true,
github bkanber / Slackadaisical / dist / MessageForm.js View on Github external
function MessageForm(channel) {
        var _this = this;

        _classCallCheck(this, MessageForm);

        this.channel = channel;
        this.screen = this.channel.screen;
        this.api = this.channel.api;

        this.form = blessed.form({
            parent: this.channel.box,
            keys: true,
            left: 0,
            bottom: 0,
            width: '100%-2',
            height: 4
            // border: {type: 'line'}
        });

        this.textbox = blessed.textbox({
            parent: this.form,
            left: 0,
            top: 0,
            width: '100%',
            height: 4,
            input: true,
github astefanutti / kubebox / kubebox.js View on Github external
function login_dialog() {
  const form = blessed.form({
    keys   : true,
    mouse  : true,
    vi     : true,
    left   : 'center',
    top    : 'center',
    width  : 53,
    height : 10,
    shrink : 'never',
    border : {
      type : 'line'
    }
  });

  form.on('element keypress', (el, ch, key) => {
    if (key.name === 'enter') {
      form.submit();
github ik9999 / searx-term / src / View / MainContent / Preferences / Form.js View on Github external
export default contentContainer => {
  return blessed.form({
    bottom: 0,
    height: '100%',
    left: 0,
    parent: contentContainer,
    vi: true,
    width: '100%'
  });
};
github shobrook / BitVision / bitvision / modals / autotrading.js View on Github external
module.exports.createToggleScreen = function(screen, callback) {
  var toggleForm = blessed.form({
    parent: screen,
    keys: true,
    type: "overlay",
    top: "center",
    left: "center",
    width: 35,
    height: 5,
    bg: colorScheme.background,
    color: "white"
  });

  let label = blessed.box({
    parent: toggleForm,
    top: 1,
    left: 2,
    width: 33,
github shobrook / BitVision / modals / login.js View on Github external
module.exports.createLoginScreen = (screen, callback) => {
  let loginForm = null;
  loginForm = blessed.form({
    parent: screen,
    keys: true,
    type: "overlay",
    top: "center",
    left: "center",
    width: 45,
    height: 20,
    bg: colorScheme.background,
    color: "white"
  });

  let label = blessed.box({
    parent: loginForm,
    top: 1,
    left: "center",
    width: 16,
github OpusCapita / fsm-workflow / packages / examples / invoice-console / forms.js View on Github external
const eventForm = ({
  screen,
  formProperties = {},
  availableEvents = [],
  onSubmit = () => {}
}) => {
  const form = blessed.form({
    label: 'Action Form',
    mouse: true,
    keys: true,
    vi: true,
    left: 0,
    top: 0,
    width: "100%",
    scrollable: true,
    scrollbar: {
      ch: " "
    },
    border: 'line',
    ...formProperties
  });

  form.on("submit", function(data) {