CSC Design System v4.0.0
VueFlavour Vue React Angular TypeScript
Flavour Vue React Angular TypeScript
PrimaryCSC UI Colors Primary Secondary AccentCustom Colors Red Orange Green Blue Purple Pink
CSC UI Colors Primary Secondary AccentCustom Colors Red Orange Green Blue Purple Pink
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-alert>

A persistent, in-flow status message: a tinted box whose type carries a status family's colours through the icon, heading and accent edge, while the body copy stays neutral.

Usage

Give the alert a heading with the prop for plain text; the heading slot overrides the prop when rich content (links, emphasis) is needed. The message goes in the default slot.

When to use

  • Persistent status that belongs to the page or a section: a maintenance notice, a failed validation summary, a quota warning.
  • Not for transient feedback on an action — use c-toasts, which overlays and closes itself; the alert stays in the layout until the consumer removes it.

Types

The four status types (error, info, success, warning) carry their status family's colours and icon; omitting type renders the neutral, brand-primary look, without an icon. Severity is signalled by the icon, the heading's ink and the accent edge, never by colouring the body text.

Closing

closeable renders a close button, but pressing it only fires the close event — removing the alert from the page stays the consumer's job.

Accessibility

The alert manages its own live-region role: warning and error interrupt (role="alert"), while the other types announce politely (role="status"). Content that is present at page load is not announced — live regions only announce changes.

Customization

Structural styling via ::part(root), ::part(icon), ::part(content), ::part(heading) and ::part(close). Colours come from the status-family semantic tokens; override the tokens to re-theme.

Examples

Basic
Vue React Angular TypeScript
<template>
  <div>
    <c-alert heading="Maintenance break" type="warning">
      The service will be unavailable on Saturday between 10:00 and 12:00.
    </c-alert>
  </div>
</template>
Types
Vue React Angular TypeScript
<template>
  <div style="display: grid; gap: 1rem">
    <c-alert>A default alert without a type.</c-alert>

    <c-alert type="info">Your session expires in 15 minutes.</c-alert>

    <c-alert type="success">Your project was created.</c-alert>

    <c-alert type="warning">Your quota is almost full.</c-alert>

    <c-alert type="error">The file could not be uploaded.</c-alert>
  </div>
</template>

API reference

<c-alert>

A persistent, in-flow status message: a tinted box whose type carries a status family's colours through the icon, heading and accent edge, while the body copy stays neutral.

Properties

PropertyAttributeTypeDefaultDescription
closeablecloseablebooleanfalse Show a close button. The alert only fires `close` — removing it from the page stays the consumer's job.
headingheadingstring— Heading rendered above the message. The `heading` slot overrides it for rich content.
typetypeCAlertType— The status type, setting the colours, the icon and how urgently the alert is announced (`warning` and `error` interrupt). Without it the alert has the neutral, brand-primary look and no icon.

Events

EventDetailDescription
closevoidFired when the close button is pressed. The alert does not hide itself — the consumer owns removal.

Slots

SlotDescription
headingRich heading content; overrides the `heading` prop
defaultThe message

CSS parts

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

PartDescription
rootThe box carrying the type's tint, hairline border and accent edge
iconThe status icon, rendered only when a `type` is set
contentThe wrapper around the heading and message content
headingThe heading paragraph rendered from the `heading` prop
closeThe close button rendered when `closeable` is set

Types

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

CAlertType

Type of the alert: the four status types carry their status family's colours and icon. Omitting it renders the neutral look, in the brand primary colour (unlike `c-status`, whose neutral pill is grey) and without an icon.

export type CAlertType = 'error' | 'info' | 'success' | 'warning';