git ssb

0+

cel / hypercombo



Tree: efc84dd991368b380bd934c8c83d25abdcb866cc

Files: efc84dd991368b380bd934c8c83d25abdcb866cc / README.md

1360 bytesRaw

hypercombo

[combo box][]: a select menu that turns into a text input if you want to choose an option that is not in the list.

Example

var combo = require('hypercombo')
var h = require('hyperscript')
var pull = require('pull-stream')

var box = combo({
  style: {width: '20ex'},
  placeholder: 'things:',
  default: 'nice thing',
  onchange: function () {
    console.log('new value:', this.value)
  },
  options: pull.values([
    h('option', {value: 'a thing'}, 'A thing'),
    h('option', {value: 'nice thing'}, 'A nice thing'),
    h('option', {value: 'other thing'}, 'Another thing')
  ])
})

document.body.appendChild(box)

License

Copyright (C) 2016 Charles Lehner

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Built with git-ssb-web