FLOATING NOTIFICATION: Non-blocking toast-style notifications
CLASSES: .tw-floating-notification-container | .tw-floating-notification | .tw-floating-notification-visible | .tw-floating-notification-icon | .tw-floating-notification-content | .tw-floating-notification-title | .tw-floating-notification-message | .tw-floating-notification-progress | .tw-floating-notification-actions | .tw-floating-notification-close
Toast notifications that appear in the top-right corner, auto-dismiss after a configurable duration,
and support stacking. Uses neutral white cards with elevated shadow. Hover pauses the auto-dismiss timer.
Requires floating_notification_controller.js for animation and auto-dismiss behavior.
Basic: A simple notification with title and close button. The
.tw-floating-notification-visible class is applied inline here for static display.
Application saved
<div class="tw-floating-notification tw-floating-notification-visible">
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">Application saved</p>
</div>
<button class="tw-floating-notification-close" type="button" aria-label="Close">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
Title + Message: Use .tw-floating-notification-title for the bold heading
and .tw-floating-notification-message for a supporting description below.
Application submitted
<div class="tw-floating-notification tw-floating-notification-visible">
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">Application submitted</p>
<p class="tw-floating-notification-message">Description text...</p>
</div>
<button class="tw-floating-notification-close" ...>...</button>
</div>
Icons: Add a .tw-floating-notification-icon element before the content area.
Uses Font Awesome 6 icons. The icon inherits neutral-600 color by default.
New admissions cycle open
Changes saved successfully
Deadline approaching
Upload failed
Generating report...
Syncing data
<div class="tw-floating-notification tw-floating-notification-visible">
<div class="tw-floating-notification-icon">
<i class="fa-solid fa-circle-info"></i>
</div>
<div class="tw-floating-notification-content">...</div>
<button class="tw-floating-notification-close" ...>...</button>
</div>
text-green-600 (success) | text-orange-600 (warning) | text-red-600 (error)
Actions: Use .tw-floating-notification-actions inside the content area
for action buttons. Notifications with actions auto-dismiss after 7 seconds instead of 4.
Use data-auto-dismiss="0" to disable auto-dismiss for critical actions.
New application received
Application archived
Export ready
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">Title</p>
<p class="tw-floating-notification-message">Message</p>
<div class="tw-floating-notification-actions">
<button class="tw-btn tw-btn-sm tw-btn-primary" type="button">Action</button>
<button class="tw-btn tw-btn-sm tw-btn-tertiary" type="button">Dismiss</button>
</div>
</div>
Full Example: Combines icon, title, message, actions, and close button. This matches the primary design spec for the component.
Application submitted successfully
Progress: The .tw-floating-notification-progress wrapper is hidden by default
and becomes visible when it contains child content. Nest a .progress / .progress-bar
component inside for determinate or indeterminate states.
Uploading documents...
Processing upload...
<div class="tw-floating-notification-progress">
<div class="tw-progress" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100">
<div class="tw-progress-bar tw-progress-bar-primary" style="width: 60%"></div>
</div>
</div>
.progress-indeterminate for unknown completion (e.g., processing uploads).
Stacking: Multiple notifications stack vertically with a gap-3 gap
inside the .tw-floating-notification-container. Newest notifications appear at the top.
This static example simulates the stacking layout without fixed positioning.
Changes saved
2 new applications received
Session expiring soon
Live: These notifications use data-controller="floating-notification"
for real slide-in animation and auto-dismiss. They are positioned inside a relative container for this demo
instead of the fixed top-right position used in production.
Hover over a notification to pause its auto-dismiss timer.
Settings updated
Report generated
3 applications pending review
<div class="tw-floating-notification-container"
data-controller="floating-notification"
role="status" aria-live="polite">
<div class="tw-floating-notification"
data-floating-notification-target="notification">
<div class="tw-floating-notification-icon">...</div>
<div class="tw-floating-notification-content">
<p class="tw-floating-notification-title">Title</p>
<p class="tw-floating-notification-message">Message</p>
</div>
<button class="tw-floating-notification-close"
data-action="click->floating-notification#dismiss"
aria-label="Close">...</button>
</div>
</div>
data-auto-dismiss="0" to disable | data-auto-dismiss="10000" for custom duration