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

A loader component that fills the nearest containing element that has css-property position set to 'relative'

Examples

Basic
Vue React Angular TypeScript
<template>
  <div style="display: grid; gap: 12px; justify-items: start">
    <c-button @click="loading = !loading">Toggle loader</c-button>

    <!-- The loader fills the nearest position: relative ancestor -->
    <div style="position: relative; height: 160px; width: 100%">
      <c-loader :visible.prop="loading" contentdelay="1">
        Loading resources
      </c-loader>
    </div>
  </div>
</template>

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

const loading = ref(true);
</script>

API reference

<c-loader>

A loader component that fills the nearest containing element that has css-property position set to 'relative'

Properties

PropertyAttributeTypeDefaultDescription
contentdelaycontentdelaynumber0Delay in seconds of showing the contents in the slot of the loader
sizesizenumber48Size of the loader
visiblevisiblebooleantrueWhether the loader is shown. Toggling this drives the fade-in / smooth fade-out — keep the element mounted and bind `visible` rather than using `v-if`, which would unmount it and skip the leave transition. For imperative control (non-Vue consumers holding an element ref) the element also exposes `show()` / `hide()` methods. The prop is named `visible` (not `show`) so it doesn't collide with the `show()` method — mirroring native `<dialog>` (`open` property + `show()`/`close()` methods). NOTE: this replaces the original Stencil `hide` prop with its inverse, so the default (`true` = shown) preserves the original default behaviour.
widthwidthnumber4Width of the loader

Methods

MethodSignatureDescription
hide()Imperatively hide the loader (plays the smooth fade-out).
show()Imperatively show the loader (plays the fade-in).

Slots

SlotDescription
defaultMessage text revealed below the spinner after `contentdelay`

CSS parts

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

PartDescription
rootThe overlay element covering the containing element (scrim, fade transition)
contentThe message wrapper anchored below the spinner