Notification

Toast-style notifications using the alert component class with semantic type modifiers. Colours, icons, and dismiss are all handled by the framework — one class does it all.

All Variants

New features available

Version 2.0 has been released with improved performance.

Changes saved

Your profile has been updated successfully.

<!-- Info — role="status" for polite announcement -->
<div class="alert info" role="status">
  <span class="axicon render" data-name="Info"></span>
  <div>
    <strong>New features available</strong>
    <p>Version 2.0 has been released.</p>
  </div>
  <button aria-label="Dismiss">
    <span class="axicon render" data-name="X"></span>
  </button>
</div>

<!-- Success -->
<div class="alert success" role="status">...</div>

<!-- Warning — role="alert" for immediate announcement -->
<div class="alert warning" role="alert">...</div>

<!-- Error -->
<div class="alert error" role="alert">...</div>

Triggered Toast Notifications

Click the buttons to trigger live notifications in the corner:

function showToast(type, title, message) {
  const toast = document.createElement('div');
  toast.className = `alert ${type}`;
  toast.setAttribute('role', type === 'error' || type === 'warning' ? 'alert' : 'status');
  toast.innerHTML = `
    <div>
      <strong>${title}</strong>
      <p>${message}</p>
    </div>
    <button aria-label="Dismiss"
            data-remove-closest=".alert">✕</button>
  `;
  document.getElementById('toast-region').appendChild(toast);
  // Auto-dismiss after 5s
  setTimeout(() => toast.remove(), 5000);
}

Text-Only (No Icon)

Your password has been changed successfully.

<!-- Minimal — no icon, just message -->
<div class="alert success" role="status">
  <p>Your password has been changed.</p>
</div>

Variants Reference

Class Colour token Use for ARIA role
alert info --a-color-info-container Tips, announcements, neutral notices role="status"
alert success --a-color-success-container Completed actions, confirmations role="status"
alert warning --a-color-warning-container Potential issues, upcoming deadlines role="alert"
alert error --a-color-error-container Failed actions, validation errors role="alert"

Dismiss Behaviour

The dismiss button uses data-remove-closest=".alert" — no library needed. For animated dismiss:

// Animated dismiss
document.addEventListener('click', e => {
  const closeBtn = e.target.closest('.alert .close');
  if (!closeBtn) return;
  const alert = closeBtn.closest('.alert');
  alert.style.opacity = '0';
  alert.style.transform = 'translateX(100%)';
  alert.style.transition = 'all 0.3s ease';
  setTimeout(() => alert.remove(), 300);
});

Accessibility

  • Use role="alert" for errors and warnings — announced immediately by screen readers
  • Use role="status" for success and info — announced politely without interrupting
  • Never rely on colour alone — always include an icon and text
  • The dismiss button needs aria-label="Dismiss" — the × icon alone is not accessible
  • For dynamically injected toasts, inject into a container with aria-live="polite"

Features

  • Semantic Structure - Built with native HTML5 elements for maximum reliability.
  • Theme Aware - Automatically adapts to all 22 Axiom01 themes via OKLCH tokens.
  • Fully Responsive - Scales perfectly from mobile to desktop screens.
  • No JS Dependency - Core functionality relies on pure CSS for maximum performance.
  • Customizable - Easily extendable via Axiom01's design tokens and modifiers.

Use Cases

The Notification component is designed for versatile implementation across modern web applications. Ideal scenarios include:

  • Dashboards & Admin Panels - Structured data presentation and interface control.
  • Content Management Systems - Organizing complex information hierarchies and media.
  • E-Commerce Platforms - Enhancing product discovery and user workflows.
  • Marketing Sites - Highlighting key product offerings cleanly and effectively.
  • SaaS Applications - Delivering native-feeling, responsive app experiences.