MigsLab UIVue 3 component workshop

Form

Tag Input

Type and press Enter to add a tag. Backspace on an empty field removes the last tag.

import { TagInputComponent, type TagItem } from '@/MigsLab/shared'

Example

VueTypeScript
Add or remove a tag.
const tags = ref<TagItem[]>([{ id: 1, label: 'Vue' }])

<TagInputComponent v-model="tags" @tag-added="Tag_Added" @tag-removed="Tag_Removed" />

API

Props

NameType Default Description
v-modelTagItem[][]Tags as { id, label }.
placeholderstring'Type and press Enter to add a tag'Input placeholder.
allowDuplicatesbooleanfalseAllow two tags with the same label.
disabledbooleanfalseDisable the text field.

Events

EventPayloadDescription
tag-addedTagItemA tag was added.
tag-removedTagItemA tag was removed.