Live examples and demonstrations
Toast notifications are lightweight, non-intrusive messages that appear temporarily on the screen to provide feedback or information to users. They automatically disappear after a set time and can be dismissed manually. The RSL toast system supports multiple positioning options, custom timeouts, different styles, and both fixed and absolute positioning.
Get up and running in 3 minutes with our Quick Start Guide!
View Quick Start Guidedata-timeout — Set auto-dismiss time in milliseconds (default: 3000).rsl-fixed — Fixed positioning relative to viewport.rsl-absolute — Absolute positioning within parent container.rsl-top-left — Position at top-left corner.rsl-top-center — Position at top-center.rsl-top-right — Position at top-right corner.rsl-bottom-left — Position at bottom-left corner.rsl-bottom-center — Position at bottom-center.rsl-bottom-right — Position at bottom-right cornerdata-toast-trigger — Button attribute to trigger toast on click
The most common toast placement is the top-right corner. This position is non-intrusive and catches the user's attention without blocking important content.
data-toast-trigger attribute to any button to make it show a toast notification. Customize the toast using data attributes for header, body, position, timeout, and background color.
Toast notifications can be positioned at six different locations on the screen. Click each button to see the toast appear in its respective position.
Style your toasts to match different notification types using custom background colors. Common patterns include success (green), error (red), warning (yellow), and info (blue).
Control how long toasts remain visible by setting custom timeout values. Shorter times for quick confirmations, longer times for messages requiring more attention.
Toast body content supports HTML, allowing you to include formatted text, links, icons, and more complex layouts within your notifications.
< for < and > for > if needed, though standard HTML usually works fine within data attributes.
For advanced use cases, you can create toasts programmatically using JavaScript. This is useful for dynamic notifications triggered by events, AJAX responses, or complex application logic.
showToast({
header: 'Custom Toast',
body: 'This was created programmatically!',
position: 'bottom-right',
timeout: 4000,
bgColor: '#6f42c1'
});
showToast({
header: 'Notification', // Header text
body: 'Message content', // Body text (supports HTML)
position: 'top-right', // Position on screen
timeout: 3000, // Auto-dismiss time (ms)
bgColor: '#007bff', // Header background color
type: 'fixed', // 'fixed' or 'absolute'
parent: null // Parent element for absolute
});
showToast() function is globally available and can be called from anywhere in your code. This makes it perfect for showing notifications in response to AJAX requests, form submissions, or other user interactions.
You can also place toast HTML directly in your page. The toast will appear automatically when the page loads and follow the same auto-dismiss behavior.
Notification Title
This toast appears when the page loads.
To use toast notifications in your project, include these CSS and JavaScript files: