1.1.9 • Published 2 months ago

simple-tags-for-vue v1.1.9

Weekly downloads
252
License
MIT
Repository
github
Last release
2 months ago

Simple tags component for Vue.js 3

A package that allows you to attach, detach and remove tags with ease, following provided suggestions. The tags are styled by default using Tailwind CSS

npm.io

Demo

Installation

NPM

npm i simple-tags-for-vue

CDN

<script src="https://www.unpkg.com/simple-tags-for-vue/dist/simple-tags-for-vue.min.js"></script>

Usage

import simple_tags_for_vue from 'simple-tags-for-vue';

// add to the components section
components: {
    'simple-tags-for-vue': simple_tags_for_vue
}
<simple-tags-for-vue v-model="selected_tags"
                     :existing="existing_tags"
></simple-tags-for-vue>

Styling

If you have tailwindcss installed, you are good to go. If not, just turn it off :tailwind="false", add class="your-own-class" and style it as you need.

Backend

POST query of the form with simple-tags-for-vue results in an array of 'tags'.

If you use Laravel with spatie/laravel-tags:

<?php

// Get tags
$tags = $model->tags->map(fn($tag) => $tag->name);
$existing_tags = Tag::all()->map(fn($tag) => $tag->name);

// Update tags
$tags = $request->input('tags') ?? [];
$model->syncTags($tags);

Properties

NameTypeDefaultDescription
modelValueArray[]Value for v-model
existingArray[]List of existing tags (used in suggestions)
unusedArray[]List of unused tags (can be permanently deleted)
tailwindBooleantrueStyle with tailwindcss

Emits

NameDescription
update:modelValueUpdate event for v-model
destroyPermanently delete tag

License

The MIT License (MIT). Please see License File for more information.

1.1.9

2 months ago

1.1.8

5 months ago

1.1.7

5 months ago

1.1.6

11 months ago

1.1.5

1 year ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.0

3 years ago

1.1.2

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago