Skip to content
Components

Toast

Brief feedback after an action.

After the one-time setup, call the helper directly from ERB. No component import is needed.

<%= lc_toast "Project saved.", timeout: 0 %>
<%= lc_toast "Project saved.", timeout: 0 %>
<%# In an app, render the region once in the layout and append toasts with turbo_stream.append. %>
<%= lc_toast_region id: "example-1-toasts" %>
<template id="example-1-toast"><%= lc_toast "Project saved." %></template>
<%= lc_button "Save project", data: { controller: "toast-demo", action: "toast-demo#show", toast_demo_template_value: "example-1-toast", toast_demo_region_value: "example-1-toasts" } %>
<%# Centred at the bottom, and at the top on phones, clear of a bottom tab bar. %>
<%= lc_toast_region id: "example-2-toasts", placement: :bottom_center, mobile_placement: :top_center %>
<template id="example-2-toast"><%= lc_toast "Expense added." %></template>
<%= lc_button "Add expense", data: { controller: "toast-demo", action: "toast-demo#show", toast_demo_template_value: "example-2-toast", toast_demo_region_value: "example-2-toasts" } %>

Helpers render semantic HTML and include their interaction wiring. Pass native attributes through class:, data:, aria: and the usual Rails options. Blocks use captured ERB content.

lc_toast

lc_toast(message = nil, tone: :success, timeout: 4000, **attributes, &block)
InputDefaultValues
messagenil—
tone:success:neutral · :primary · :success · :warning · :destructive
timeout4000—
attributes{}Native HTML attributes; class:, data: and aria: merge with defaults
blockCaptured blockCaptured Rails ERB content

lc_toast_region

lc_toast_region(placement: :bottom_end, mobile_placement: nil, **attributes, &block)
InputDefaultValues
placement:bottom_end—
mobile_placementnil—
attributes{}Native HTML attributes; class:, data: and aria: merge with defaults
blockCaptured blockCaptured Rails ERB content

The examples also use lc_button. Each is documented on its own page.

Styling and extension

Use class: to merge utilities, native attributes for application behavior, and the theming guide for the shared palette. For custom markup, the advanced class helpers expose the same styles, including glass surfaces and class merging.

API JSON · LLM reference