render RailsUi::Toast::Component.new
run :
document.dispatchEvent(new CustomEvent('ui:toast', {
detail: {
title: 'Event has been created',
content: 'Your event was successfully created.',
type: 'success'
}
}))
or in the controller:
def create
# ... your create logic ...
respond_to do |format|
format.turbo_stream do
render turbo_stream: turbo_stream.append("toasts",
render(RailsUi::Toast::ToastItemComponent.new(
title: "Event has been created",
content: "Your event was successfully created.",
type: "success"
))
)
end
end
end