5 HTML5-based input for typing lists of tags, tokens, or other discrete values.
7 No dependencies required. 6kb gzipped.
9 ![screenshot](https://dl.dropboxusercontent.com/u/42869844/LTS/TagSelect.gif)
13 * Built-in validation, with visual feedback on unexpected values.
14 * Full keyboard/cursor support (you can type anywhere in the input).
15 * Full copy/paste support.
17 Currently, all non-word characters are treated as tag dividers. More separator options may be added in the future.
19 > **Compatibility:** Only modern browsers are supported. Some of the nicer features of this plugin (copy/paste support, native selection and cursor movement) aren't realistic on older browsers.
23 ## Quickstart (Scripts)
25 Include the files from `dist/` in your project. Example:
28 <link rel="stylesheet" href="tagselect.min.css">
29 <script src="tagselect.min.js"></script>
32 Next, you can use the plugin in your own JavaScript. If you have an element with the ID 'my-input':
35 <div id="my-input"></div>
39 var element = document.querySelector('#my-input');
40 var tags = new TagSelect(element, {
41 options: ['Red', 'Green', 'Blue', 'Yellow', 'Orange', 'Magenta']
45 ## Quickstart (NPM + Browserify / Webpack)
50 npm install --save TagSelect.js
53 And use it in your script:
56 var TagSelect = require('TagSelect.js');
58 var element = document.querySelector('#my-input');
59 var tags = new TagSelect(element, {
60 options: ['Red', 'Green', 'Blue', 'Yellow', 'Orange', 'Magenta']
68 *************************/
69 var selected = tags.get();
70 // => ['Magenta, 'Yellow']
73 *************************/
77 *************************/
78 tags.on('change', function () {
79 console.log('Tags updated!');
80 console.log(tags.get());
88 To get started, you'll need install the development dependencies:
94 Development tasks, like compiling [Sass](http://sass-lang.com/) and minifying JavaScript, are handled by [NPM scripts](https://docs.npmjs.com/misc/scripts).
97 # Run a local development server, recompiling files on update.
100 # Rebuild all CSS and JS.
103 # Bump the version, commit the dist/, and release on NPM.
104 npm version [ major | minor | patch ]