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

<c-tags>

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">
    <c-tags>
      <c-tag
        v-for="topic in topics"
        :key="topic.id"
        :active="topic.active"
        closeable
        @click="topic.active = !topic.active"
        @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', active: false },
    { id: 'chemistry', label: 'Chemistry', active: false },
    { id: 'physics', label: 'Physics', active: false },
  ];
};

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>

Properties

PropertyAttributeTypeDefaultDescription
labellabelstring''Label of the tag group, shown above the tags
requiredrequiredbooleanfalseSet as required — shows the required marker on the label
sizesizeCTagsSize'default'Size of the tags

Slots

SlotDescription
defaultDefault slot for the c-tag elements

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'

CTagsProps
export interface CTagsProps {
  /**
   * Label of the tag group, shown above the tags
   *
   * @freeform
   */
  label?: string;
  /**
   * Set as required — shows the required marker on the label
   */
  required?: boolean;
  /**
   * Size of the tags
   *
   * @seeded from csc-ui — verify
   */
  size?: CTagsSize;
}
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>

Properties

PropertyAttributeTypeDefaultDescription
activeactivebooleanfalseMark tag as active
badgebadgenull | number | stringnullDisplay an optional badge at the start of the tag
closeablecloseablebooleanfalseMark tag as closeable
flatflatbooleanfalseRemove the hover effect
sizesizeCTagSize'default'Size of the tag

Events

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

Slots

SlotDescription
defaultDefault slot

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'

CTagProps
export interface CTagProps {
  /**
   * Mark tag as active
   *
   * @seeded from csc-ui — verify
   */
  active?: boolean;
  /**
   * Display an optional badge at the start of the tag
   *
   * @seeded from csc-ui — verify
   */
  badge?: null | number | string;
  /**
   * Mark tag as closeable
   *
   * @seeded from csc-ui — verify
   */
  closeable?: boolean;
  /**
   * Remove the hover effect
   *
   * @seeded from csc-ui — verify
   */
  flat?: boolean;
  /**
   * Size of the tag
   *
   * @seeded from csc-ui — verify
   */
  size?: CTagSize;
}
CTagSize

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

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