CSC Design System v4
VueFlavour Vue React Angular TypeScriptPrimaryCSC UI ColorsPrimarySecondaryAccentCustom ColorsRedOrangeGreenBluePurplePink
Guides Getting started Customization Data visualization Migration guide Componentsc-accordionc-alertc-autocompletec-badgec-breadcrumbc-buttonc-button-groupc-cardc-checkboxc-color-pickerc-csc-logoc-data-tablec-date-pickerc-dividerc-file-uploadc-iconc-icon-buttonc-linkc-listc-loaderc-login-buttonsc-login-cardc-mainc-menuc-messagec-modalc-navigation-buttonc-number-fieldc-otp-inputc-pagec-paginationc-popoverc-progress-barc-progress-circlec-radio-groupc-selectc-side-navigationc-sliderc-spinnerc-statusc-stepsc-switchc-tablec-tabsc-tagsc-text-fieldc-time-pickerc-toastsc-toolbarc-tooltipc-tree-select

<c-tags>

A group of `c-tag` elements laid out in a wrapping row, with an optional group label above them.

Usage

Put the tags in the default slot; the row wraps onto further lines when it runs out of width. The group holds no value and fires no event of its own: what a tag means, whether it is active and when it is removed are up to you.

<c-tags label="Research fields">
  <c-tag active>All</c-tag>
  <c-tag>Biosciences</c-tag>
  <c-tag>Chemistry</c-tag>
</c-tags>

When to use

  • Showing a set of keywords, categories or applied filters, one tag each.
  • For picking several values in a form, use c-select or c-autocomplete with multiple; they show each pick as a tag inside the field.
  • For a small set of choices that holds a value, use c-button-group.

Tags

A c-tag takes its text in the default slot. These props combine:

  • active paints the filled, selected look. A tag never sets it itself: listen for click and toggle it.
  • badge shows a number or a short text in a small pill at the tag's start.
  • flat makes the tag a plain label: no hover effect, not a button, and out of the Tab order.
  • closeable adds a close button.

Pressing the close button fires close on that tag. The event does not bubble, so listen on each tag; removing the tag stays your job:

<c-tags label="Topics">
  <c-tag
    v-for="topic in topics"
    :key="topic.id"
    :close-label="`Remove ${topic.label}`"
    closeable
    @close="remove(topic.id)"
  >
    {{ topic.label }}
  </c-tag>
</c-tags>

Size

Set size on the group, not on its tags: size="small" renders every tag in the group compact, and the group's size overrides a tag's own size.

Accessibility

  • With a label, the group is a role="group" named by it, and required adds the required marker. Without one, aria-label or aria-labelledby on the element names the group; with neither the row is a plain container.
  • A plain tag — neither closeable nor flat — is a toggle button: a Tab stop that Enter and Space press, each firing click as a mouse click does, and announced with active as its pressed state. Toggle active in your click handler.
  • A closeable tag is not a Tab stop itself: its close button is. The button's accessible name is close-label, "Remove" by default, so give each tag a label naming what it removes, as in the example above.
  • A flat tag is skipped by Tab.

Customization

Restyle via CSS parts: ::part(root) stacks the label above the row, ::part(label) is the group label and ::part(items) is the wrapping row. The tags stay in your own markup, so style them directly through their root part, the tag's visible box:

c-tags::part(items) {
  gap: 0.5rem;
}

c-tag::part(root) {
  font-weight: 600;
}

Examples

Basic
Vue React Angular TypeScript
<template>
  <div style="display: grid; gap: 1rem">
    <c-tags>
      <c-tag active>All</c-tag>

      <c-tag>Biosciences</c-tag>

      <c-tag>Chemistry</c-tag>

      <c-tag>Physics</c-tag>
    </c-tags>

    <c-tags size="small">
      <c-tag active>All</c-tag>

      <c-tag>Biosciences</c-tag>

      <c-tag>Chemistry</c-tag>

      <c-tag>Physics</c-tag>
    </c-tags>
  </div>
</template>
Label
Vue React Angular TypeScript
<template>
  <c-tags label="Research fields" required>
    <c-tag active>All</c-tag>

    <c-tag>Biosciences</c-tag>

    <c-tag>Chemistry</c-tag>

    <c-tag>Physics</c-tag>
  </c-tags>
</template>
Basic · c-tag
Vue React Angular TypeScript
<template>
  <div class="example-row">
    <c-tag>Default</c-tag>

    <c-tag active>Active</c-tag>

    <c-tag badge="3">With badge</c-tag>

    <c-tag flat>Flat</c-tag>

    <c-tag size="small">Small</c-tag>
  </div>
</template>
Closeable · c-tag
Vue React Angular TypeScript
<template>
  <div class="example-grid">
    <!-- A closeable tag's close button is its only control; it emits `close`. -->
    <c-tags>
      <c-tag
        v-for="topic in topics"
        :key="topic.id"
        closeable
        @close="onRemoveTopic(topic.id)"
      >
        {{ topic.label }}
      </c-tag>
    </c-tags>

    <div>
      <c-button @click="onResetTopics()">Reset topics</c-button>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue';

const createTopics = () => {
  return [
    { id: 'biosciences', label: 'Biosciences' },
    { id: 'chemistry', label: 'Chemistry' },
    { id: 'physics', label: 'Physics' },
  ];
};

const topics = ref(createTopics());

const onRemoveTopic = (topic: string) => {
  topics.value = topics.value.filter((t) => t.id !== topic);
};

const onResetTopics = () => {
  topics.value = createTopics();
};
</script>

API reference

<c-tags>

A group of `c-tag` elements laid out in a wrapping row, with an optional group label above them.

Properties

PropertyAttributeTypeDefaultDescription
labellabelstring'' Label of the tag group, shown above the tags
requiredrequiredbooleanfalse Set as required — shows the required marker on the label
sizesizeCTagsSize'default' Size of every tag in the group: `small` renders them compact. Overrides each tag's own `size`

Slots

SlotDescription
defaultThe `c-tag` elements of the group

CSS parts

Style from outside with c-tags::part(name) — parts are the library's only styling customization API.

PartDescription
rootThe wrapper stacking the group label above the tags
labelThe group label rendered above the tags
itemsThe wrapping row that lays out the slotted tags

Types

Importable from the package root: import type { … } from '@cscfi/csc-ui'

CTagsSize

Size propagated to every slotted `<c-tag>`. `small` renders compact tags; omitting the attribute leaves the tags at their default size.

export type CTagsSize = 'default' | 'small';

<c-tag>

A pill-shaped tag naming one item — a keyword, a category, an applied filter — authored inside `c-tags`, or on its own where a single tag is needed, such as a status in a table cell. With `closeable` it shows a close button that fires `close` and leaves removing the tag to you; name that button with `close-label`, for example "Remove Chemistry".

Properties

PropertyAttributeTypeDefaultDescription
activeactivebooleanfalse Paint the filled, selected look, announced as the pressed state of a plain tag. The tag never sets it itself: toggle it on `click`
badgebadgenull | number | stringnull A number or short text shown in a small pill at the start of the tag
closeablecloseablebooleanfalse Add a close button that fires `close`; removing the tag stays your job. The button, not the tag, is then the Tab stop
closeLabelclose-labelstring'Remove' Accessible name of the close button rendered when `closeable`
flatflatbooleanfalse Make the tag a plain label: no hover effect, not a button, and out of the Tab order
sizesizeCTagSize'default' Size of the tag: `small` renders a compact pill. Inside `c-tags`, the group's `size` overrides it

Events

EventDetailDescription
closevoidFired when the tag's close button is activated.

Slots

SlotDescription
defaultThe tag's text

CSS parts

Style from outside with c-tag::part(name) — parts are the library's only styling customization API.

PartDescription
rootThe tag's visible pill-shaped box

Types

Importable from the package root: import type { … } from '@cscfi/csc-ui'

CTagSize

Size of the tag. `small` renders a more compact pill; omitting the attribute renders the default size.

export type CTagSize = 'default' | 'small';