vdom-buttons

0.0.5 • Public • Published

vdom buttons

A few buttons, virtual-dom style.

demo

install

$ npm install vdom-buttons

example

var vdom = require('virtual-dom');
var h = vdom.h;
var buttons = require('vdom-buttons');
// or require one thing
var edit = require('vdom-buttons/lib/edit');
 
var loop = require('main-loop')( {}, render, vdom );
document.getElementById('content').appendChild(loop.target);
 
function render() {
  return h('div', Object.keys(buttons).map(k => {
    // use normal hyperscript attributes
    return buttons[k](h, {
      onclick: ev => {
        ev.preventDefault();
        console.log('click', k);
      },
      style: {
        marginRight: '1em'
      }
    });
  }));
}

Dependents (2)

Package Sidebar

Install

npm i vdom-buttons

Weekly Downloads

3

Version

0.0.5

License

ISC

Last publish

Collaborators

  • nichoth