vue-tag-selector
A simple tag selector as a vue component.
Vue-tag-selector is a component for vuejs for tag type fields.
Light (6.3kb gzipped) and customizable.
Offering regex validation.
Installation
# with npm
npm install --save vue-tag-selector
# with yarn
yarn add vue-tag-selector
Usage
For using the component you just need to import the component and register it:
And then use it in your template:
API Documentation
Here's a list of the props available:
label
: Displays a label, has to be String can be ignoredname
: Required. usually the field name.classes
: Allows you to add classes to the field. String or Array.regex
: A RegExp. Validates every tag and disallow adding if not matching. By default it's alphanumerical only (/^[a-zA-Z0-9]*$/
)regexError
: The error displayed when the Regex doesn't match
Style
The component philosophy is pretty straightforward here: only the mandatory style is bundled.
I personally never liked js library that needs too much CSS.
Only 26 lines of CSS here ?.
But you can easily stylize the component.
Have an example template:
One rule tho, .tag-selector--input
has to be display: flex;
.