Skip to content

Tag & Tags

A removable, value-bound chip and a list helper that renders one chip per item. Pure-CSS — no Reka primitive.

<VCTag> is the display-only counterpart to <VCFormTags> (which composes Reka's interactive TagsInputItem + input). Use Tag when you want chip rendering without an input — read-only summaries, profile pills, list-row badges. Use <VCFormTags> when you need the editable chip-input combo.

bash
npm install @vuecs/elements
vue
<script setup lang="ts">
import { VCTag, VCTags } from '@vuecs/elements';
import { ref } from 'vue';

const tags = ref([
    { value: 'vue', label: 'Vue' },
    { value: 'reka', label: 'Reka UI' },
    { value: 'tailwind', label: 'Tailwind' },
]);

function remove(value: string | number | undefined) {
    tags.value = tags.value.filter((t) => t.value !== value);
}
</script>

<template>
    <VCTag value="static" label="Static chip" />
    <VCTag value="removable" label="Removable" removable />

    <VCTags :items="tags" removable @remove="remove" />
</template>
css
@import "tailwindcss";
@import "@vuecs/design";
@import "@vuecs/elements";

<VCTag>

PropTypeDefaultDescription
valuestring | numberundefinedBound value — emitted on remove.
labelstringundefinedDisplay text; default slot wins if both provided.
iconstringundefinedIconify-style name forwarded to the leading icon slot.
removablebooleanfalseRender the trailing remove button.
size'sm' | 'md' | 'lg'theme default (md)Size variant — mirrors <VCBadge> sizes for visual consistency.
themeClassPartial<TagThemeClasses>undefinedPer-instance theme override.
EmitPayloadDescription
removevalue: string | number | undefinedFired when the remove button is clicked.

<VCTags>

Flex container that renders <VCTag> per entry. Items can be plain strings/numbers (coerced to { value, label: String(value) }) or TagItem objects.

ts
type TagItem = {
    value: string | number;
    label?: string;
    icon?: string;
    /** Per-chip override; falls back to the list-level `size`. */
    size?: 'sm' | 'md' | 'lg';
    /** Skips the remove button on this chip even when list-level `removable` is true. */
    disabled?: boolean;
};

TagItem is structurally compatible with @vuecs/forms' FormOption so the same array can drive a select and a chip summary.

PropTypeDefaultDescription
items(TagItem | string | number)[][]Items to render.
removablebooleanfalseShow remove buttons on every chip (per-item disabled opts out).
size'sm' | 'md' | 'lg'theme default (md)Default size forwarded to every chip; per-item size overrides.
themeClassPartial<TagsThemeClasses>undefinedPer-instance theme override.
EmitPayloadDescription
remove(value, item)Fired with the bound value and the resolved TagItem.

Theme keys

ComponentKeyDefault class
tagrootvc-tag
tagiconvc-tag-icon
tagremovevc-tag-remove
tagsrootvc-tags
tagsitemvc-tags-item

Released under the Apache 2.0 License.