nega-autocomplete
v0.2.4
Published
An autocomplete webcomponent
Downloads
62
Readme
<nega-autocomplete>
A simple autocomplete web component.
See: Documentation, Demo.
Usage
Installation
npm install --save nega-autocomplete
In an html file
<html>
<head>
<script type="module">
import 'nega-autocomplete/nega-autocomplete.js';
</script>
</head>
<body>
<nega-autocomplete items="["dog","cat","bird","fish","rabbit","fox","bear"]">
<input type="text" placeholder="Animals" />
</nega-autocomplete>
</body>
</html>
In a Polymer 3 element
import {PolymerElement, html} from '@polymer/polymer';
import 'nega-autocomplete/nega-autocomplete.js';
class SampleElement extends PolymerElement {
static get template() {
return html`
<nega-autocomplete .items=[[items]]>
<input type="text" placeholder="Animals" />
</nega-autocomplete>
`;
}
static get properties() {
return {
items: {type: Array, value: ['dog', 'cat', 'bird', 'fish', 'rabbit', 'fox', 'bear']}
}
}
}
customElements.define('sample-element', SampleElement);
Contributing
Feel free to fork and send over PRs. Still a lot of places this can be improved, i.e. styling, more options, or better behaviors.
Installation
git clone https://github.com/kennethklee/nega-autocomplete
cd nega-autocomplete
npm install
Running locally
$ npm start
Running tests
$ npm test