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-icon>

An icon drawn from a single SVG path, sized in pixels and filled with the colour of the surrounding text unless given one of its own.

Usage

Pass the icon path in path: the path data of an icon drawn on a 24×24 grid, typically an export of @mdi/js (Material Design Icons). The icon renders at 24px; size sets another width and height in pixels.

In the icon slot of another component, such as c-button, c-menu-item or c-status, leave size unset: the component sizes the icon to match. c-status sizes it whatever its size; elsewhere a size of its own wins.

<script setup lang="ts">
import { mdiCheckCircle } from '@mdi/js';
</script>

<template>
  <c-icon :path="mdiCheckCircle" :size="20" />
</template>

Colour

Without color, the icon fills with currentColor, so it takes the text colour of its surroundings: inside a c-button or c-icon-button it follows the button's appearance and disabled state. To recolour it, set the CSS color on the element or an ancestor, or pass any CSS colour in color. Prefer the semantic tokens, such as color="var(--c-success)", which follow the theme mode.

Accessibility

The icon is an unnamed <svg> unless the element has an aria-label.

  • A decorative icon, one beside a visible label that says the same thing: set aria-hidden="true" on the c-icon so screen readers skip it.
  • Inside a control named by its aria-label, such as a c-icon-button, the label replaces the icon; nothing more is needed.
  • A meaningful icon with no visible text, such as a status shown only as an icon: name it with aria-label on the c-icon, which makes it an image (role="img") with that name.
<c-icon
  :path="mdiCheckCircle"
  aria-label="Completed"
  color="var(--c-success)"
/>

Customization

::part(root) is the <svg>. Its width and height are set inline from size, or from the icon slot it sits in, so size the icon with the prop. A color set on the part recolours an icon that has no color prop of its own.

Examples

Basic
Vue React Angular TypeScript
<template>
  <div class="example-row">
    <c-icon :path="mdiAccount" />

    <c-icon :path="mdiBellOutline" size="36" />

    <c-icon :path="mdiCheckCircle" color="var(--c-success)" size="36" />
  </div>
</template>

<script setup lang="ts">
import { mdiAccount, mdiBellOutline, mdiCheckCircle } from '@mdi/js';
</script>

API reference

<c-icon>

An icon drawn from a single SVG path, sized in pixels and filled with the colour of the surrounding text unless given one of its own.

Properties

PropertyAttributeTypeDefaultDescription
colorcolorstring'currentColor' Fill color.
pathpathstring— Svg `path` `d` attribute value.
sizesizenumber24 Icon size in pixels. Unset, the icon takes the size of the icon slot it sits in.

CSS parts

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

PartDescription
rootThe `<svg>` element rendering the icon