Live Toast

A beautiful drop-in replacement for the Phoenix Flash system.

Why Live Toast?

The existing flash system in Phoenix has a few limitations:

  1. You can't have multiple flash messages of the same type open at the same time.
  2. The default styles need a new coat of paint.

Creating a Toast component

Creating your own toast component with Phoenix LiveView is a relatively trivial task. You can make a Phoenix.LiveComponent that maintains a list of toasts in memory, and use send/1 to send messages directly to it, or use update/3 to update it's assigns directly. Either way is ok.

Because it's a relatively simple task, it's may not be worth it as a library, but what if you have existing flash messages too? Odds are, if you build your own toast system, you'll want to either make your flashes look the same, or get rid of them and switch everything over to your new toast system.

LiveToast has a solution for this situation: it just ships with the ability to override both your flash messages and provide a new toast system with the benefits that brings (more than one message per kind, etc).