Rapid Rails UI Pro

Upgrade to unlock this component

Get Pro →

Alert

Contextual feedback messages for user actions and system notifications.

Key Features

  • Multiple Types - Info, success, warning, danger, error, and primary
  • Visual Variants - Solid, soft, and outline styles
  • Dismissible - Close button with smooth fade animation
  • Auto Dismiss - Automatic dismissal with countdown timer and progress bar
  • Progress Bar - Visual countdown indicator that pauses on hover
  • Undo Action - Built-in undo pattern for destructive operations (like Gmail)
  • Clickable Alerts - Navigate on click with Turbo support
  • Animations - Smooth enter/exit fade and scale transitions
  • Turbo Stream - Native integration for real-time notifications
  • Multiple Messages - Display single message or list of messages
  • Border Accents - Left, top, or bottom border emphasis
  • Action Buttons - Add call-to-action buttons
  • Custom Icons - Override default type icons
  • Full Accessibility - ARIA attributes for screen readers
  • JavaScript API - Programmatic control with data-action attributes

Quick Reference

Copy and paste these examples. That's it.

rui_flash — All flash messages, one line
<%= rui_flash %>
rui_flash (toast) — Toast-style positioning
<%= rui_flash(position: :top_right) %>
rui_flash_container — For Turbo Stream updates (put in layout)
<%= rui_flash_container(position: :top_right) %>
rui_errors — Model validation errors
<%= rui_errors(@post) %>
rui_alert — Basic alert with content
<%= rui_alert(:success, title: "Saved!") { "Changes saved." } %>
rui_alert (dismissible) — With close button
<%= rui_alert(:info, dismissible: true) { "Click X to dismiss." } %>
rui_alert (auto-dismiss) — Auto-dismisses after X seconds
<%= rui_alert(:success, auto_dismiss: true, dismiss_after: 5) { "Gone in 5s" } %>
rui_alert (undo) — Gmail-style undo action
<%= rui_alert(:warning, undo_url: undo_path(@item)) { "Deleted." } %>
rui_alert_turbo — For Turbo Stream responses
<%= turbo_stream.prepend "rui-flash-container" do %>
  <%= rui_alert_turbo(:success, messages: "Saved!") %>
<% end %>

Controller Setup

Copy these patterns into your controllers.

Step 1: Add to Layout
# app/views/layouts/application.html.erb
<body>
  <%= rui_flash %>

  <%= yield %>
</body>
Step 2: Use Flash Keys in Controller
# app/controllers/posts_controller.rb

def create
  @post = Post.new(post_params)
  if @post.save
    flash[:success] = "Post created!"   # Green alert
    redirect_to @post
  else
    render :new, status: :unprocessable_entity
  end
end

def update
  if @post.update(post_params)
    flash[:info] = "Post updated."      # Blue alert
    redirect_to @post
  else
    render :edit, status: :unprocessable_entity
  end
end

def destroy
  @post.destroy
  flash[:warning] = "Post deleted."     # Amber alert (no auto-dismiss)
  redirect_to posts_path
end

def some_action_that_fails
  flash[:danger] = "Something went wrong!"  # Red alert (no auto-dismiss)
  redirect_to root_path
end
Flash Key → Alert Type
Flash Key Color Auto-dismiss Use For
:success Green Yes (5s) Create, publish, complete
:info Blue Yes (8s) Update, save draft, informational
:warning Amber No Delete, archive, caution
:danger Red No Errors, failures, critical
Step 3: Add Model Errors to Forms
# app/views/posts/_form.html.erb
<%= form_with(model: @post) do |f| %>
  <%= rui_errors(@post) %>

  <!-- form fields here -->

  <%= f.rui_button %>
<% end %>

Basic Usage

Simple alerts with a title and content block. The type can be passed as a positional argument.

<%# Positional type (recommended) %>
<%= rui_alert(:info) do %>
  This is an informational message.
<% end %>

<%= rui_alert(:success, title: "Success!") do %>
  Your changes have been saved.
<% end %>

<%# Keyword argument also works %>
<%= rui_alert(type: :info, title: "Note") { "..." } %>

Alert Types

Each type has a semantic color and default icon.

<%= rui_alert(:default, title: "Default") { "..." } %>
<%= rui_alert(:info, title: "Info") { "..." } %>
<%= rui_alert(:success, title: "Success") { "..." } %>
<%= rui_alert(:warning, title: "Warning") { "..." } %>
<%= rui_alert(:danger, title: "Danger") { "..." } %>
<%= rui_alert(:primary, title: "Primary") { "..." } %>

Colors

Beyond the predefined types, Alert supports custom styling using semantic colors and any Tailwind color.

Custom Semantic Colors

Use custom color parameters to style alerts with semantic or Tailwind colors.

Tailwind Colors

All Tailwind colors are fully supported with automatic dark mode variants.

<!-- Semantic colors with variants -->
<%= rui_alert(:info, color: :primary, variant: :soft) { "Custom primary color" } %>
<%= rui_alert(:info, color: :success, variant: :solid) { "Custom success color" } %>
<%= rui_alert(:info, color: :danger, variant: :outline) { "Custom danger color" } %>

<!-- Tailwind colors (all supported!) -->
<%= rui_alert(:info, color: :red, variant: :soft) { "Red alert" } %>
<%= rui_alert(:info, color: :blue, variant: :solid) { "Blue alert" } %>
<%= rui_alert(:info, color: :purple, variant: :outline) { "Purple alert" } %>
<%= rui_alert(:info, color: :pink, variant: :soft) { "Pink alert" } %>

Variants

Three visual styles to choose from.

<%= rui_alert(:info, variant: :soft) { "..." } %>
<%= rui_alert(:info, variant: :solid) { "..." } %>
<%= rui_alert(:info, variant: :outline) { "..." } %>

Sizes

Five sizes from extra small to extra large.

<%= rui_alert(:info, size: :xs) { "..." } %>
<%= rui_alert(:info, size: :sm) { "..." } %>
<%= rui_alert(:info, size: :base) { "..." } %>
<%= rui_alert(:info, size: :lg) { "..." } %>
<%= rui_alert(:info, size: :xl) { "..." } %>

Shapes

Control the border radius of alerts.

<%= rui_alert(:info, shape: :square) { "..." } %>
<%= rui_alert(:info, shape: :rounded) { "..." } %>
<%= rui_alert(:info, shape: :pill) { "..." } %>

Border Accent

Add emphasis with colored border accents.

<%= rui_alert(:warning, border_position: :left) { "..." } %>
<%= rui_alert(:danger, border_position: :top) { "..." } %>
<%= rui_alert(:success, border_position: :bottom) { "..." } %>

Messages

Display single or multiple messages. Multiple messages render as a list.

<%= rui_alert(:danger, messages: "Email is required") %>

<%= rui_alert(:danger, title: "Errors:", messages: [
  "Email is required",
  "Password must be at least 8 characters"
]) %>

Dismissible

Add a close button to allow users to dismiss the alert.

<%= rui_alert(:info, dismissible: true, title: "Dismissible") do %>
  Click the X to dismiss.
<% end %>

Auto Dismiss

Automatically dismiss the alert after a specified time.

<%= rui_alert(:success, auto_dismiss: true, dismiss_after: 10) do %>
  This will disappear in 10 seconds.
<% end %>

Custom Icons

Override the default type icon with a custom one, or hide icons entirely.

<%= rui_alert(:info, title: "Custom Icon") do |alert| %>
  <%= alert.with_icon(:bell) %>
  Custom icon content.
<% end %>

<%= rui_alert(:warning, show_icon: false) do %>
  No icon shown.
<% end %>

Action Buttons

Add call-to-action buttons to alerts.

<%= rui_alert(:warning, title: "Confirm") do |alert| %>
  <% alert.with_action("Confirm", variant: :solid) %>
  <% alert.with_action("Cancel") %>
  Are you sure?
<% end %>

Undo Action (SaaS Pattern)

Built-in undo support for destructive operations—like Gmail, Slack, and other modern SaaS apps. The alert automatically shows an Undo button and handles the request via Turbo.

<%= rui_alert(:warning,
      title: "Post Deleted",
      undo_url: undo_post_path(@post),
      auto_dismiss: true,
      dismiss_after: 10) do %>
  Your post has been moved to trash.
<% end %>

<%# With custom HTTP method %>
<%= rui_alert(:warning,
      undo_url: restore_path(@item),
      undo_method: :patch) do %>
  Item archived. Click Undo to restore.
<% end %>

Tip: The undo button makes a Turbo-compatible request and dispatches an alert:undo JavaScript event. Use undo_method: :patch or :delete for RESTful undo actions.

Clickable Alerts

Make alerts clickable for notifications that navigate somewhere. Perfect for "New message" or "New comment" notifications.

New Comment
John replied to your post. Click to view →
8
<%# Click anywhere to navigate (uses Turbo) %>
<%= rui_alert(:info,
      title: "New Comment",
      href: post_path(@post, anchor: "comments")) do %>
  John replied to your post. Click to view.
<% end %>

<%# Target a Turbo Frame %>
<%= rui_alert(:info,
      title: "New Message",
      href: message_path(@message),
      turbo_frame: "message-panel") do %>
  You have a new message.
<% end %>

Note: Uses Turbo for smooth navigation (no full page reload). Clicking buttons or links inside the alert won't trigger navigation.

Animations

Alerts have smooth enter/exit animations by default when they're interactive (dismissible, auto-dismiss, clickable, or have undo).

<%# Animations enabled by default for dismissible alerts %>
<%= rui_alert(:success, dismissible: true) do %>
  Animates in and out.
<% end %>

<%# Disable animations %>
<%= rui_alert(:info, animate: false, dismissible: true) do %>
  No animation.
<% end %>

<%# Force animations on static alerts %>
<%= rui_alert(:info, animate: true) do %>
  This static alert will animate in.
<% end %>

Animation behavior:
Enter: Fades in and scales up (300ms ease-out)
Exit: Fades out and scales down (200ms ease-in)
• Auto-enabled when dismissible, auto_dismiss, href, or undo_url is set

Smart Flash Messages

RapidRailsUI provides a first-class flash message system that builds on Rails Flash with automatic styling, accessibility, and smart behaviors—all in one line of code.

Rails Flash vs RapidRailsUI

Rails provides ActionDispatch::Flash for passing temporary data between actions. However, it's data-only—you must build the UI yourself. RapidRailsUI wraps Rails Flash with a complete, production-ready component.

❌ Standard Rails (Manual Work)

class ApplicationController < ActionController::Base
  add_flash_types :success, :warning, :info, :danger
end

<% flash.each do |type, message| %>
  <div class="alert alert-<%= type %>
    <%= type == 'danger' ? 'bg-red-100' : '' %>
    <%= type == 'success' ? 'bg-green-100' : '' %>
    <%= type == 'warning' ? 'bg-amber-100' : '' %>
    <%= type == 'info' ? 'bg-blue-100' : '' %>"
    role="alert">
    <button onclick="this.parentElement.remove()">
      ×
    </button>
    <%= message %>
  </div>
<% end %>

✅ RapidRailsUI (One Line)

<%= rui_flash %>






Feature Rails Flash RapidRailsUI
Default flash types 2 (alert, notice) 7 (auto-mapped)
UI Component ❌ Build yourself ✅ Included
Semantic colors ❌ Manual CSS ✅ Automatic
Auto-dismiss ❌ Write JS ✅ Built-in
Countdown timer ❌ Write JS ✅ Built-in
Close button ❌ Build yourself ✅ Included
Animations ❌ Write CSS/JS ✅ Smooth fade
ARIA accessibility ❌ Add manually ✅ Complete
Dark mode ❌ Style yourself ✅ Automatic
Icons per type ❌ Add manually ✅ Contextual
Severity ordering ❌ Manual sort ✅ Auto (danger first)
Max messages limit ❌ Write logic max: 3
Toast positioning ❌ Write CSS position: :top_right
Lines of code More than 1 line 1 line
🚀 Zero Configuration

Works immediately with standard Rails flash keys. No add_flash_types needed.

🎨 Production-Ready Design

Beautiful, consistent styling with variants, sizes, and dark mode—battle-tested in real apps.

♿ Fully Accessible

Complete ARIA attributes, screen reader support, and keyboard navigation built-in.

🔴 Live Examples

See flash messages in action! Create, edit, or delete a post to see the alerts.

Semantic Flash Keys

Use semantic flash keys in your controller to get context-aware alert colors:

Flash Key Alert Type Use Case
flash[:success] :success (green) Create, publish, complete actions
flash[:info] :info (blue) Update, save as draft, informational
flash[:warning] :warning (amber) Delete, archive, destructive actions
flash[:danger] :danger (red) Errors, failures, critical issues

Context-Aware CRUD Examples

# posts_controller.rb - Context-aware flash messages

def create
  @post = Post.new(post_params)
  if @post.save
    # Different message based on status
    if @post.status == "published"
      flash[:success] = "Post published successfully!"
    elsif @post.status == "draft"
      flash[:info] = "Post saved as draft."
    else
      flash[:success] = "Post created successfully!"
    end
    redirect_to @post
  else
    render :new, status: :unprocessable_entity
  end
end

def update
  if @post.update(post_params)
    if @post.status == "published"
      flash[:success] = "Post updated and published!"
    elsif @post.status == "archived"
      flash[:warning] = "Post archived."
    else
      flash[:info] = "Post updated (draft)."
    end
    redirect_to @post
  else
    render :edit, status: :unprocessable_entity
  end
end

def destroy
  @post.destroy
  flash[:warning] = "Post was deleted."  # Warning for destructive action
  redirect_to posts_path
end

def publish
  @post.update(status: "published", published_at: Time.current)
  flash[:success] = "Post is now live!"
  redirect_to @post
end

Smart Flash Helper

One line renders all flash messages with context-aware styling:

<%# That's it! One line does everything. %>
<%= rui_flash %>

The component automatically:

  • Maps flash keys to alert types (success → green, warning → amber, etc.)
  • Auto-dismisses success/info alerts after 5 seconds
  • Keeps warning/danger alerts visible until dismissed
  • Shows countdown timer and close button

Options

<%# Basic usage %>
<%= rui_flash %>

<%# With custom wrapper class %>
<%= rui_flash(class: "max-w-2xl mx-auto") %>

<%# Disable auto-dismiss for all %>
<%= rui_flash(auto_dismiss: false) %>

<%# Custom dismiss timing %>
<%= rui_flash(dismiss_after: 10) %>

<%# With custom variant %>
<%= rui_flash(variant: :outline) %>

<%# Limit max visible messages (shows "and X more") %>
<%= rui_flash(max: 3) %>

<%# Toast-style positioning %>
<%= rui_flash(position: :top_right) %>
<%= rui_flash(position: :bottom_center) %>

Position Options

Position Description
:inline Default, renders in document flow
:top_left Fixed top-left corner
:top_center Fixed top-center
:top_right Fixed top-right corner
:bottom_left Fixed bottom-left corner
:bottom_center Fixed bottom-center
:bottom_right Fixed bottom-right corner

Smart Model Errors Helper

One line renders model validation errors with automatic title:

<%# That's it! One line does everything. %>
<%= rui_errors(@post) %>

The component automatically:

  • Returns nothing if model has no errors
  • Generates title like "2 errors prohibited this post from being saved:"
  • Renders all error messages as a list
  • Uses danger (red) styling

Options

<%# With custom title %>
<%= rui_errors(@user, title: "Please fix these issues:") %>

<%# With custom styling %>
<%= rui_errors(@post, variant: :outline, border_position: :left) %>

Full Form Example

<%= form_with(model: @post) do |f| %>
  <%= rui_errors(@post) %>

  <!-- form fields -->

  <%= f.rui_button(color: :success) %>
<% end %>

📝 Try It Out!

The Posts CRUD demonstrates context-aware flash messages:

  • Create as PublishedGreen success alert
  • Create as DraftBlue info alert
  • UpdateBlue info or green success based on status
  • DeleteAmber warning alert (no auto-dismiss)
  • Form ErrorsRed danger alert with messages list

Turbo Stream Integration

Native Turbo Stream support for real-time notifications. Perfect for modern Rails apps with Hotwire.

Flash Container (Recommended)

Place in your layout for Turbo Stream flash updates:

<%# app/views/layouts/application.html.erb %>
<body>
  <%= rui_flash_container(position: :top_right) %>

  <%= yield %>
</body>

Benefits: Stable ID (rui-flash-container) for Turbo Stream targeting, renders existing flash messages, and supports toast-style positioning.

Sending Alerts via Turbo Stream

<%# In a turbo_stream.erb view %>
<%= turbo_stream.prepend "rui-flash-container" do %>
  <%= rui_alert_turbo(:success, title: "Saved!", messages: "Changes saved.") %>
<% end %>

<%# In controller %>
respond_to do |format|
  format.turbo_stream do
    render turbo_stream: turbo_stream.prepend(
      "rui-flash-container",
      helpers.rui_alert_turbo(:success, messages: "Done!")
    )
  end
end

Real-Time Notifications

Broadcast alerts via ActionCable for real-time updates:

# In a background job or controller
Turbo::StreamsChannel.broadcast_prepend_to(
  current_user,
  target: "rui-flash-container",
  html: helpers.rui_alert_turbo(:info,
    title: "New Message",
    messages: "You have a new message.",
    href: messages_path
  )
)

JavaScript Events

Listen for alert events in your Stimulus controllers:

// Listen for dismiss events
document.addEventListener("alert:dismissed", (event) => {
  console.log("Alert dismissed:", event.detail.element)
})

// Listen for undo events
document.addEventListener("alert:undo", (event) => {
  console.log("Undo clicked:", event.detail.element)
})

Accessibility

The Alert component follows WAI-ARIA best practices for accessible alert messages.

ARIA Attributes

  • role="alert" for screen reader announcements
  • aria-live="polite" for non-urgent alerts
  • aria-live="assertive" for urgent danger alerts
  • aria-atomic="true" announces entire alert when updated
  • aria-hidden="true" on icons to avoid redundant announcements

Keyboard Navigation

  • Tab navigates to action buttons and close button
  • Enter or Space activates buttons
  • Focus states are clearly visible with ring styles

Semantic HTML

  • Uses semantic <div> with proper ARIA roles
  • Action buttons use <button> for proper interaction
  • WCAG AA contrast (≥4.5:1) for all color variants

Screen Reader Support

  • Alert types (info, success, warning, danger) are clearly announced
  • Auto-dismiss countdown is announced to screen readers
  • Undo and dismiss actions are announced as interactive buttons

Example: Accessible Alerts


<%= rui_alert(:success, title: "Success!") do %>
  Your changes have been saved successfully.
<% end %>

<%= rui_alert(:warning, title: "Changes Not Saved", dismissible: true) do %>
  Please review the errors before proceeding.
<% end %>

<%= rui_alert(:danger, title: "Action Required", dismiss_after: 0) do %>
  Your session will expire in 5 minutes.
<% end %>

<%= rui_alert(:success, title: "Post Published", undo_url: undo_post_path(@post)) %>
<!-- Announces "Undo" as actionable button -->

Color & Variant Compatibility

Different color and variant combinations affect readability and contrast. This guide helps you choose the best combination for accessibility and UX.

Solid Variant with Bright Colors

When using bright colors (amber, yellow, lime, orange) with the solid variant, the component automatically uses dark text for proper WCAG AA contrast.

Amber - Dark text (auto)
Yellow - Dark text (auto)
Lime - Dark text (auto)
Orange - Dark text (auto)

Variant Recommendations

  • Solid: Best for important messages. Use for success, danger, and warnings. Dark text auto-applied for bright colors.
  • Soft: Good general-purpose variant. Subtle background with readable text. Great for info messages.
  • Outline: Least prominent. Use for supplementary information or when you want minimal visual weight.

✓ Best Practices

  • Solid variant with cool colors (blue, indigo, purple) is most readable
  • Bright color + soft variant works well for eye-catching but readable alerts
  • Always include a title for semantic clarity and screen readers
  • Test your color combinations in both light and dark modes

JavaScript API

The Alert component uses a Stimulus controller. All behavior is configured via data attributes.

Data Attributes

These are automatically added by the component. Listed here for reference.

Attribute Type Description
data-controller="alert" - Activates the alert controller
data-alert-auto-dismiss-value Boolean Enable auto-dismiss countdown
data-alert-dismiss-after-value Number Seconds before auto-dismiss (default: 5)
data-alert-animate-value Boolean Enable enter/exit animations
data-alert-href-value String URL for clickable alerts
data-alert-turbo-frame-value String Turbo Frame ID to target
data-alert-undo-url-value String URL for undo request
data-alert-undo-method-value String HTTP method for undo (default: post)

Stimulus Actions

Use these actions via data-action attributes:

Action Description
alert#dismiss Dismisses the alert with animation
alert#undo Triggers undo action and dismisses (sends request if undoUrl configured)
alert#navigate Navigates to href (for clickable alerts)
alert#pause Pauses auto-dismiss countdown (use on mouseenter)
alert#resume Resumes auto-dismiss countdown (use on mouseleave)
Using Stimulus Actions
<%# Dismiss button %>
<button data-action="click->alert#dismiss">
  Close
</button>

<%# Undo button with server-side action %>
<button data-action="click->alert#undo">
  Undo
</button>

<%# Pause countdown on hover %>
<div data-controller="alert"
     data-alert-auto-dismiss-value="true"
     data-alert-dismiss-after-value="5"
     data-action="mouseenter->alert#pause mouseleave->alert#resume">
  Alert content...
</div>

Custom Events

Listen to these events for lifecycle hooks:

Event When Detail
alert:dismissed Alert is dismissed (before removal) {}
alert:undo Undo action triggered {}
Listening to Events
<%# Track when alerts are dismissed %>
<div data-controller="analytics"
     data-action="alert:dismissed->analytics#trackDismissal
                  alert:undo->analytics#trackUndo">
  <%= rui_alert(:success, dismissible: true) do %>
    Action completed!
  <% end %>
</div>

<%# In your Stimulus controller %>
// analytics_controller.js
trackDismissal(event) {
  console.log("Alert dismissed")
}

trackUndo(event) {
  console.log("Undo clicked")
}

Programmatic Control

Control the alert from JavaScript using the Stimulus controller:

Programmatic Control
// Get the alert controller
const alertElement = document.querySelector('[data-controller="alert"]')
const alertController = application.getControllerForElementAndIdentifier(
  alertElement,
  "alert"
)

// Dismiss programmatically
alertController.dismiss()

// Trigger undo
alertController.undo()

// Pause/resume countdown
alertController.pause()
alertController.resume()

API Reference

rui_alert

Contextual feedback messages with auto-dismiss, undo support, and Turbo Stream integration

Parameter Type Default Description
type* Symbol :info Alert type (positional or keyword)
:default :info :success :warning :danger :error :primary

Appearance

Visual styling options

Parameter Type Default Description
title String Alert title (bold text)
variant Symbol :soft Visual style
:solid :soft :outline
size Symbol :base Alert size
:xs :sm :base :lg :xl
shape Symbol :rounded Border radius
:square :rounded :pill
border_position Symbol :none Border accent position
:none :left :top :bottom :all

Dismissal

Auto-dismiss and close button options

Parameter Type Default Description
dismissible Boolean false Show dismiss (X) button
auto_dismiss Boolean false Auto-dismiss after timeout
dismiss_after Integer 5 Seconds before auto-dismiss
show_progress_bar Boolean auto Show visual countdown (auto: true when auto_dismiss enabled)
animate Boolean auto Enter/exit animations (auto: true when interactive)

Navigation

Clickable alert options for notifications

Parameter Type Default Description
href String URL for clickable alert (uses Turbo navigation)
turbo_frame String Turbo Frame ID to target for navigation

Undo Action

Built-in undo pattern for destructive operations

Parameter Type Default Description
undo_url String URL to call when undo is clicked
undo_method Symbol :post HTTP method for undo request
:post :patch :put :delete

Content

Message and icon options

Parameter Type Default Description
messages String/Array Message(s) to display (multiple renders as list)
show_icon Boolean true Show type-specific icon

rui_flash Helper

Renders all flash messages with context-aware styling

Parameter Type Default Description
position Symbol :inline Toast positioning
:inline :top_left :top_center :top_right :bottom_left :bottom_center :bottom_right
max Integer Max messages to show (displays 'and X more' for overflow)
class String Custom CSS classes for wrapper
auto_dismiss Boolean smart Override auto-dismiss (smart: true for success/info, false for warning/danger)
dismiss_after Integer 5/8 Seconds before auto-dismiss (5 for success, 8 for others)
variant Symbol :soft Visual variant for all alerts
:solid :soft :outline

rui_errors Helper

Renders model validation errors as danger alert

Parameter Type Default Description
model* ActiveModel Model with errors (positional argument)
title String auto Custom title (auto-generates 'X errors prohibited this model from being saved:')
variant Symbol :soft Visual variant
:solid :soft :outline
border_position Symbol :none Border accent
:none :left :top :bottom :all

rui_flash_container Helper

Renders a container for Turbo Stream flash updates. Place in layout for real-time notifications.

Parameter Type Default Description
id String "rui-flash-container" Container ID for Turbo Stream targeting
position Symbol :top_right Toast positioning
:inline :top_left :top_center :top_right :bottom_left :bottom_center :bottom_right
class String Custom CSS classes

rui_alert_turbo Helper

Renders a single alert for Turbo Stream responses. Use in controllers or turbo_stream views.

Parameter Type Default Description
type* Symbol Alert type (positional argument)
:success :info :warning :danger
title String Alert title
messages String/Array Message(s) to display
auto_dismiss Boolean smart Auto-dismiss behavior (smart: true for success/info)
dismiss_after Integer 5/8 Seconds before dismiss
undo_url String URL for undo action
href String URL for clickable alert

Slots

Content slots for customizing component parts

Slot Description
icon Custom icon via alert.with_icon(:name) - replaces default type icon
actions Action buttons via alert.with_action('text', variant:, color:) - multiple allowed

Related Components