Skip to content

Alert

Display contextual feedback messages for user actions or system events.

Open in Storybook

Interactive Demo

Variants

All variants

With Action

Alert with action button

Usage

vue
<script setup>
import { ref } from 'vue';
import { Alert } from '@yellowcard/b2b-design-system';

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

<template>
  <Alert
    v-model="showAlert"
    variant="success"
    title="Transfer complete"
    subtitle="Your funds have been sent successfully."
    :dismissible="true"
    :autoDismiss="true"
    :autoDismissDelay="5000"
  />
</template>

API Reference

Props

PropTypeDefaultDescription
title*stringAlert heading text
subtitlestring''Supporting description text
variant'information' | 'warning' | 'success' | 'urgent''information'Visual style and intent
size'large' | 'small''large'Alert size
position'top-left' | 'top-right' | 'top-center' | 'bottom-left' | 'bottom-right' | 'bottom-center' | 'center''top-right'Screen position for floating alerts
actionLabelstring''Text for optional action button
dismissiblebooleantrueShow close button
autoDismissbooleanfalseAutomatically dismiss after delay
autoDismissDelaynumber5000Auto-dismiss delay in milliseconds
modelValuebooleantrueControls visibility (v-model)

Events

EventPayloadDescription
update:modelValuebooleanEmitted when visibility changes
dismissEmitted when alert is dismissed
actionEmitted when action button is clicked

Accessibility

  • Uses role="alert" with aria-live="polite" for screen reader announcement
  • Close button has configurable aria-label (default: "Close alert")
  • Focus is managed when alerts appear/disappear