2.0.1 • Published 6 years ago
choo-tags-input v2.0.1
Choo Tags Input
Installation
npm install -S choo-tags-input
Usage
const html = require('choo/html')
const TagsInputComponent = require('choo-tags-input')
module.exports = FormComponent
const tagInput = TagsInputComponent('customInputId', 'customInputName', onTagsChange(emit))
function FormComponent(state, emit) {
return html`
<form>
<div class="form-group">
<label for="customInputId">Input label</label>
${ tagInput.render(state.tags) }
</div>
</form>
`
}
// Change handler (for adding or removing tags)
function onTagsChange(emit) {
return function (inputName, values) {
emit('<eventName>', inputName, values)
}
}