Skip to content
On this page

Tags

Used for marking and selection.

Basic Usage

User can't add two equal tags.

Add tag
<template>
  <div class="flex flex-col">
    <HcTags
      v-model="value"
      label="Lable text"
      placeholder="Add tag"
    />
  </div>
</template>

<script lang="ts" setup>
import { HcTags } from '@deeepvision/hope-component-kit';
import { ref } from 'vue';

const value = ref<string[]>([]);
</script>

Readonly

Change the state of the component to readonly with the readonly property.

<template>
  <div class="flex flex-col">
    <HcTags
      v-model="value"
      label="Lable text"
      placeholder="Add tag"
      readonly
    />
  </div>
</template>

<script lang="ts" setup>
import { HcTags } from '@deeepvision/hope-component-kit';
import { ref } from 'vue';

const value = ref<string[]>(['tag1', 'tag2', 'tag3']);
</script>

Disable editing

Use prop disableEditing if you need to allow user only create tags not edit.

Add tag
<template>
  <div class="flex flex-col">
    <HcTags
      v-model="value"
      label="Lable text"
      placeholder="Add tag"
      disable-editing
    />
  </div>
</template>

<script lang="ts" setup>
import { HcTags } from '@deeepvision/hope-component-kit';
import { ref } from 'vue';

const value = ref<string[]>([]);
</script>

Errors

Use props errorMsg to show error message and error state of the component

Add tag
This fild is required
<template>
  <div class="flex flex-col">
    <HcTags
      v-model="value"
      label="Lable text"
      placeholder="Add tag"
      error-msg="This fild is required"
    />
  </div>
</template>

<script lang="ts" setup>
import { HcTags } from '@deeepvision/hope-component-kit';
import { ref } from 'vue';

const value = ref<string[]>([]);
</script>

Types

TagState: new | editing | complete;

Tag:

OptionType
idstring
stateTagState
prevStateTagState
valuestring

Props

PropertyType Values Description Default
modelValueString[]String[]binding valuefalse
maxLengthNumberNumbermax count of the tagsundefined
labelStringStringlabel text
placeholderStringStringplaceholder text of tag input
errorMsgStringStringerror message
readonlyBooleanBooleanwhether component is read onlyfalse
disableEditingBooleanBooleanwhether user can edit tag text after creatingfalse

Slots

PropertyType Values Description Default
label-suffix-customize label suffix content

Events

PropertyType Values Description Default
update:model-valueFunctionvalue - string[]triggers when the binding value changes
blurFunctionvalue - string[]triggers when Tags blurs
focusFunctionvalue - Tagtriggers when Tags focuses

Created by DeepVision Software.