Inlay Alerts Examples

Live examples and demonstrations

Inlay Alerts

Inlay Alerts are versatile, accessible notification components that provide contextual feedback to users. They support multiple types (success, danger, warning, info, default), can be styled with various drop shadows, and include auto-closing functionality with progress indicators. All alerts are ADA-compliant with proper ARIA labels, keyboard navigation, and screen reader support.

New to Inlay Alerts?

Get up and running in 5 minutes with our Quick Start Guide!

View Quick Start Guide
Alert Types
.alert-success — Green background for successful actions
.alert-danger — Red background for errors or critical warnings
.alert-warning — Yellow background for warnings
.alert-info — Cyan background for informational messages
.alert-default — Gray background for neutral messages

Drop Shadow Options (optional)
.alert-dropshadow-a — Inset shadow for depth effect
.alert-dropshadow-b — Multi-layer shadow for dramatic effect
.alert-dropshadow-c — Subtle inset shadow
.alert-dropshadow-d — Standard box shadow

ADA Features
• Proper ARIA roles and labels for screen readers
• Keyboard accessible close buttons
• Focus management for dynamically generated alerts
• High contrast color combinations
• Meaningful icon associations

Download RSL Example Pack

Basic Static Alerts

Static alerts are pre-rendered HTML elements that are present on page load. They include a close button that allows users to dismiss them.

Code • HTML


                    

Alerts with Drop Shadows

Add depth and visual interest to your alerts using the drop shadow classes.

Code • HTML


                    

Alerts with Titles and Details

Provide more context with title and detail combinations.

Code • HTML


                    

Dynamic Alerts (JavaScript Generated)

Use the generateAlert() function to create alerts programmatically with custom options.

Code • JavaScript

// Basic alert
generateAlert({
    type: 'success',
    message: 'Success!',
    details: 'Your operation completed successfully.',
    location: '#dynamicAlertContainer'
});

// Alert with custom styling
generateAlert({
    type: 'info',
    message: 'Custom Alert',
    details: 'This alert has custom colors and icon.',
    location: '#dynamicAlertContainer',
    dropShadow: 'alert-dropshadow-c',
    overrideIcon: 'fa-star',
    overrideBackgroundColor: '#9b59b6',
    overrideTextColor: '#ffffff'
});

// Auto-closing alert with timeout
generateAlert({
    type: 'warning',
    message: 'Auto-Close',
    details: 'This alert will close after 3 seconds.',
    location: '#dynamicAlertContainer',
    timeout: 3000
});

// Alert with callbacks
generateAlert({
    type: 'info',
    message: 'With Callbacks',
    details: 'This alert has onShow and onClose callbacks.',
    location: '#dynamicAlertContainer',
    onShow: function() {
        console.log('Alert shown!');
    },
    onClose: function() {
        console.log('Alert closed!');
    }
});
                    

generateAlert() Function Options

The generateAlert() function accepts an object with the following properties:

Required Options

  • type - Alert type: 'success', 'danger', 'warning', 'info', or 'default'
  • message - Main heading text for the alert
  • details - Detailed message text
  • location - CSS selector for container (#id or .class)

Optional Styling

  • dropShadow - Shadow class: 'alert-dropshadow-a', 'b', 'c', or 'd'
  • wrapMessage - Wrap details in styled container: 'true' or 'false'
  • animation - CSS animation class to apply
  • overrideIcon - FontAwesome icon class (e.g., 'fa-user')

Color Overrides

  • overrideBackgroundColor - Custom background color (hex, rgb, or color name)
  • overrideTextColor - Custom text color
  • overrideTitleColor - Custom title color
  • overrideIconColor - Custom icon color
  • overrideCloseColor - Custom close button color

Behavior Options

  • timeout - Auto-close after X milliseconds
  • onShow - Callback function when alert is shown
  • onClose - Callback function when alert is closed

Alerts in Grid Layouts

Inlay alerts work seamlessly within RSL's grid system, making them perfect for dashboard notifications or form validation.

Code • HTML

ADA Compliance Features

Inlay Alerts are designed with accessibility in mind, ensuring all users can interact with notifications effectively.

ARIA Attributes

  • role="alert" - Announces the alert to screen readers
  • aria-label - Provides descriptive label with alert type and content
  • aria-hidden="true" on icons - Prevents redundant icon announcements
  • aria-label="Close" on buttons - Clear close button labeling

Keyboard Navigation

  • Close buttons are keyboard accessible (Tab to focus, Enter/Space to activate)
  • Focus indicators clearly show button state
  • Natural tab order maintained
  • No keyboard traps

Visual Accessibility

  • High contrast color combinations meet WCAG AA standards
  • Icons provide visual reinforcement of alert type
  • Clear close button with sufficient target size (44x44px minimum)
  • Text remains readable on all background colors

Responsive Design

  • Touch-friendly close buttons on mobile devices
  • Alerts stack properly on small screens
  • Text scales appropriately across breakpoints
  • No horizontal scrolling required

Best Practices

When to Use Each Alert Type

  • Success: Confirmations, successful operations, completed tasks
  • Danger: Errors, critical warnings, failed operations, security issues
  • Warning: Cautions, non-critical issues, pending actions, deprecation notices
  • Info: Helpful tips, feature announcements, informational messages, updates
  • Default: Generic messages, neutral notifications

Content Guidelines

  • Keep messages concise and actionable
  • Use clear, plain language without jargon
  • Provide specific information about what happened and what to do next
  • Use titles to summarize, details to explain
  • For errors, explain what went wrong and how to fix it

Placement Recommendations

  • Form validation: Place alerts near the form or at the top of the page
  • Page-level notifications: Place at the top of content area
  • Dashboard widgets: Place alerts within their respective grid items
  • Avoid placing alerts where they might obscure important content