pebble / clay

Pebble Config Framework
MIT License
120 stars 29 forks source link

Multiline text #132

Closed AntMurray closed 7 years ago

AntMurray commented 8 years ago

Great work and good format so converting to clay!

Not aware of any method for multiline text. Currently there is no option for textarea or multiline text input?

https://forums.pebble.com/t/multiline-support-in-clay-input-attached-link-to-my-github-repo/22039

Thanks

keegan-lillo commented 7 years ago

Not directly out of the box, but you should be able to make one pretty easily with custom components. Something like this should do the trick.

clay-component-textarea.js

module.exports = {
  name: 'input',
  template: '<div class="component component-textarea">' +
              '<label class="tap-highlight">' +
                '<span class="label">{{{label}}}</span>' +
                '<span class="input">' +
                  '<textarea data-manipulator-target></textarea>' +
                '</span>' +
              '</label>' +
              '{{if description}}' +
                '<div class="description">{{{description}}}</div>' +
              '{{/if}}' +
            '</div>',
  style: '.component-textarea textarea {height: 5em; /*etc...*/}',
  manipulator: 'val',
  defaults: {
    label: '',
    description: ''
  }
};

app.js

var Clay = require('pebble-clay');
var clayConfig = require('./config.json');
var clay = new Clay(clayConfig);

clay.registerComponent(require('./clay-component-textarea'));
keegan-lillo commented 7 years ago

Sorry about the very very late reply.