vdom-file-upload

File upload state machine for virtual dom renderer

Usage no npm install needed!

<script type="module">
  import vdomFileUpload from 'https://cdn.skypack.dev/vdom-file-upload';
</script>

README

vdom file upload

File upload UI component for virtual dom rendering engine.

demo

install

$ npm install vdom-file-upload

example

var vdom = require('virtual-dom');
var FileUpload = require('vdom-file-upload');

// return `observ-struct` instance
var state = FileUpload({
  label: 'example',
  onChange: function(files) {
    console.log('change', files);
  }
});

var loop = require('main-loop')(
  state(),
  // pass in a hyperscript function
  FileUpload.render.bind(null, vdom.h),
  vdom
);

state(loop.update);
document.getElementById('content').appendChild(loop.target);