Include the dist/style.css file on your page to apply the styling. You can use CDN, require() it inside your JS code, or @include it inside your (S)CSS assets. Read the Styling section to learn how to customize the appearance.

Installation via CDN

If you're not using NPM, you can include the required files into your page manually from a CDN. Don't forget to include Vue as well. For example:

element-id will be applied to id and name attributes of the hidden input that contains the list of the selected tags as its value. Optionally you can also use the v-model directive to bind a variable to the array of selected tags.

existing-tags is the list of the existing on your website tags. Include it even if you're not using typeahead.

Remove the typeahead property to disable this functionality.

Setting Selected Tags Programmatically

If you need to programmatically (manually) set or change the list of selected tags from "outside" - just set the required value to the variable bound with the component via v-model.

Data

The list of selected tags is stored as a string (tags separated with a comma) inside a hidden input with id and name set to the value from the element-id props (but only if you've provided this prop).

You can also bind the array of selected tags to a variable via v-model.

If a tag is listed in existing-tags, the tag's slug will be used, otherwise the text entered by user is added.

Example value of the hidden input:

web-development,javascript,This is a new tag,php

Styling

If you want to completely re-style the component - write your own styles from scratch using dist/style.css as a reference. Alternatively you can override specific parts of dist/style.css using !important.

Certain classes/styles can be overridden via component props on a per instance basis in case you just want to make minor changes, e.g. you just want to change colors.

Prop

Default class

Area

wrapper-class

tags-input-wrapper-default

Outer appearance of the input - a wrapper providing a border and padding around the selected tags. If you're using CSS frameworks, you could use the frameworks' native classes, e.g. form-control for Bootstrap or input for Bulma.

Using Typeahead (Autocomplete)

When search results are displayed underneath the input, use the arrow down and arrow up keys on the keyboard to move the selection. Press Enter to select a tag. Press Esc to discard the search results and then Enter to add a new tag the way you've typed it.

Updating From Older Versions

Older versions up to v1.4.0 -> v1.5.0

The oldTags property was removed. See the Setting Selected Tags Programmatically section on how to (pre)set the list of existing tags.

v1.5.0 -> v1.5.1

TagsInput was renamed to VoerroTagsInput to eliminate possible name conflicts with other packages.

Support

This software is absolutely free to use and is developed in the author's free time. If you found this software useful and would like to say thank you to the author, please consider making a donation. It's not the amount, it's the gesture.