Every example is a complete Vue file. Copy it into an app that has the registry installed, or open it in StackBlitz.
Add and remove tags
Enter adds the text as a tag; the × removes one.
TagsInputBasic.vue
<script setup lang="ts">
import { ref } from 'vue'
import { TagsInput, TagsInputInput, TagsInputItem, TagsInputItemDelete, TagsInputItemText } from '@/components/ui/tags-input'
const tags = ref(['summer', 'best seller', 'free shipping'])
</script>
<template>
<div class="grid w-full max-w-96 gap-(--bh-space-100)">
<label for="product-tags" class="text-(--bh-color-text) [font:var(--bh-font-label-default)]">Product tags</label>
<TagsInput v-model="tags">
<TagsInputItem v-for="tag in tags" :key="tag" :value="tag">
<TagsInputItemText />
<TagsInputItemDelete />
</TagsInputItem>
<TagsInputInput id="product-tags" placeholder="Add a tag…" aria-describedby="product-tags-hint" />
</TagsInput>
<p id="product-tags-hint" class="m-0 text-(--bh-color-text-subtle) [font:var(--bh-font-body-small)]">Press Enter after each tag.</p>
</div>
</template>Email addresses
A comma or a paste adds several at once.
Up to 5 addresses. Paste a list separated by commas.
TagsInputEmails.vue
<script setup lang="ts">
import { ref } from 'vue'
import { TagsInput, TagsInputInput, TagsInputItem, TagsInputItemDelete, TagsInputItemText } from '@/components/ui/tags-input'
const recipients = ref(['[email protected]', '[email protected]'])
</script>
<template>
<div class="grid w-full max-w-96 gap-(--bh-space-100)">
<label for="alert-recipients" class="text-(--bh-color-text) [font:var(--bh-font-label-default)]">Send sync alerts to</label>
<TagsInput v-model="recipients" :max="5" delimiter="," add-on-paste add-on-blur>
<TagsInputItem v-for="email in recipients" :key="email" :value="email">
<TagsInputItemText />
<TagsInputItemDelete />
</TagsInputItem>
<TagsInputInput id="alert-recipients" type="email" placeholder="[email protected]" aria-describedby="alert-recipients-hint" />
</TagsInput>
<p id="alert-recipients-hint" class="m-0 text-(--bh-color-text-subtle) [font:var(--bh-font-body-small)]">Up to 5 addresses. Paste a list separated by commas.</p>
</div>
</template>Disabled
Tags stay readable.
Channels come from the CRM. Change them there.
TagsInputDisabled.vue
<script setup lang="ts">
import { TagsInput, TagsInputInput, TagsInputItem, TagsInputItemDelete, TagsInputItemText } from '@/components/ui/tags-input'
const channels = ['Online store', 'Marketplace A']
</script>
<template>
<div class="grid w-full max-w-96 gap-(--bh-space-100)">
<label for="sales-channels" class="text-(--bh-color-text) [font:var(--bh-font-label-default)]">Sales channels</label>
<TagsInput :model-value="channels" disabled>
<TagsInputItem v-for="channel in channels" :key="channel" :value="channel">
<TagsInputItemText />
<TagsInputItemDelete />
</TagsInputItem>
<TagsInputInput id="sales-channels" aria-describedby="sales-channels-hint" />
</TagsInput>
<p id="sales-channels-hint" class="m-0 text-(--bh-color-text-subtle) [font:var(--bh-font-body-small)]">Channels come from the CRM. Change them there.</p>
</div>
</template>