Toast Edit
A succinct message that is displayed temporarily.
Examples
<%= render_toast header: "Scheduled: Catch up",
description: "Friday, February 10, 2023 at 5:57 PM",
action: render_button("Undo", variant: :outline),
id: "default_toast" %>
Installation
rails generate shadcn-ui toast
Usage
<%= render_toast header: ,
description: %>
The Toast component introduces:
app/helpers/components/toast_helper.rbapp/javascript/controllers/ui/toast_controller.jsapp/views/components/ui/_toast.html.erb
render_toast accepts two keyword arguments, one for the header and the second for the description
or body of the toast. An optional 3rd argument can be provided for an action element like a button.
<%= render_toast header: "Invalid Login",
id: "alert_toast",
description: "Could not find email password combination.",
variant: :destructive,
auto: false,
class: "hidden" %>