sezaru
Hey everyone,
I made a small library to extend the current flash notification functionality from Phoenix and LiveView.
Flashy is a simple replacement for the built-in flash support and components that ships with Phoenix.
Features:
- Keep notifications between redirects;
- Support rendering function and live components as notifications;
- Support auto-hide;
- Supports creation of custom notifications;
- No Javascript library is used.
Here is small video showing it is practice:
You can check it out here: GitHub - sezaru/flashy: Flashy is a small library that extends LiveView's flash support to function and live components. · GitHub
If you want to test it out first, you can clone my example project here: GitHub - sezaru/flashy_example: Small project showing Flashy features · GitHub
Trending in Announcing
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries.
offset-based pagination with...
New
I needed to reuse React components from my Chrome extension in my Phoenix/LiveView backend. I noticed that for Svelte/Vue, there are live...
New
I released Doggo, a collection of unstyled Phoenix components.
https://github.com/woylie/doggo
Features
Unstyled Phoenix components....
New
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Hello
Published a new library - ProcessHub!
ProcessHub is a library designed to manage process distribution within the Elixir cluster. ...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
It’s not that it’s vocabulary is too advanced. It’s something worse.
I get lost trying to follow even a paragraph written by Claude. It’...
New
This showed up on my feed.. anyone heard of it? Just hype?
Ox Alpha is a reasoning model designed for coding, sustained ag...
New
Hey folks,
I just published a post about Hologram’s funding and where the project goes next - the short version:
Curiosum as Main Spons...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #hex
- #security










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
TwistingTwists
Lovely stuff. Would give this a spin on first chance I get.
christhekeele
This looks amazing, I’ll try to incorporate it into my next project for sure, if they are customizable enough in animation direction!
Morotai
awesome stuff. I imaging these notifications (including the default flash) could be trigger on any page say when I am looking at a list but I have another important list I want to monitor that is not on the current page?
sezaru
I didn’t make it customizable in that regard.
TBH I think the library can be more flexible in some regards like this one, for example, the code that do the transitions are in this file: flashy/lib/flashy/helpers.ex at master · sezaru/flashy · GitHub
We could make it like a behavior so you can replace it with something else, but I didn’t do it yet since I was not sure what are people requirements and use cases.
sezaru
I’m not sure if I got the question right, but you should expect similar behavior to Phoenix flash since it uses it behind the scenes. As long as you have access to the page socket, you can add notifications to it and also to another page if you redirect.
Just to give some more context, what I mean as using flash behind the scenes is because that the built-in flash architecture from phoenix working like a key, value map.
Normally, with the
flash_groupcomponent, you will send thekindof flash (:info,:error, etc) as the key and flash_group will show that. That’s why you can’t stack multiple:infoflashs at the same time, because they will have the same key and its value will just be replaced.What flashy does is two things, the first it use something else as the key, to be more specific I use a string like this as the key:
That guarantees that each notification is unique and will not conflict one with another when showing them in the screen.
The other thing is that flashy uses a notification struct as the value, not a message. You can put whatever data you want inside that struct, but the only requirement is that you implement the
Flashy.Protocolfor it. That protocol will tell Flashy which component/live component to render.christhekeele
Definitely the right call—better to not introduce the wrong abstraction early on until you have more use-cases.
For context, I maintain two LiveView PWAs and so to look good on mobile devices, my notifications tend to be banners that animate down from the top of the viewport; full-width on mobile and fixed-width on larger devices.
Those are nice, clean
Phoenix.LiveView.JSstructs that should be easy to let be more configurable! If I were tasked to make it more extensible, I’d probably start with allowing per-notification animations similar to other options, ex a@notification.options.show_animation, with fallbacks to your existing implementation.I imagine after letting that cook for a while, some patterns for re-use would emerge out of realworld codebases—perhaps a callback module, or extra options to
use Flashy.Normal, or project-wideconfig :flashy, :animations-type stuff!sezaru
Hey everyone,
I just pushed a new version of
Flashy0.2.0.The main features of this version are:
@christhekeele I think this version will have all the customization you probably need.
I added a new section to the README explaining step-by-step how to customize the notifications to make them show in the left side as an example, you can find it here:
https://github.com/sezaru/flashy#customizing-css
I also added a branch called
left_side_notificationsto theflashy_examplerepo with these customization in case someone want to just see it in action.victorbjorklund
Fantastic package! Been wanting this for a while! Just one question, perhaps I made a mistake, but it doesn’t seem to work at all on dead views. For example if we have a redirect due to “require_authenticated_user” plug and we add a message it crashes even if it redirects to a LiveView page. Is this expected behaviour or do I miss something?
sezaru
Oh, I never tested deadviews, do you have a small code example that triggers the problem for me to try it by any chance?
lc0815
love it mucho , thanks for your effort