Skip to content

Tags Input

Tag inputs render tags inside an input, followed by an actual text input.

Examples

Default

Apple
Banana
vue
<script setup>
import { ref } from 'vue'
import {
  TagsInput,
  TagsInputInput,
  TagsInputItem,
  TagsInputItemDelete,
  TagsInputItemText
} from '@empathyds/vue'

const modelValue = ref(['Apple', 'Banana'])
</script>

<template>
  <TagsInput v-model="modelValue">
    <TagsInputItem v-for="item in modelValue" :key="item" :value="item">
      <TagsInputItemText />
      <TagsInputItemDelete />
    </TagsInputItem>
    <TagsInputInput placeholder="Fruits..." />
  </TagsInput>
</template>

Props

TagsInput

PropTypeDefaultDescription
modelValuestring[]-The controlled value of the tags input.
defaultValuestring[]-The default value of the tags input.
addOnPastebooleanfalseWhether to add a tag when pasting.
disabledbooleanfalseWhether the tags input is disabled.
namestring-The name of the tags input.
requiredbooleanfalseWhether the tags input is required.
dirltr | rtl-The reading direction of the tags input.
maxnumber-The maximum number of tags.
idstring-The id of the tags input.

Slots

TagsInput

SlotDescription
defaultThe content of the tags input.

TagsInputItem

SlotDescription
defaultThe content of the tag item.