Does Liveview support view-transitions?

Just read about this in HTMX’s blog post:

</> htmx ~ Examples ~ View Transitions

It’s called “view transitions” and it’s coming into the standard. Anyone play with this even outside of Liveview perhaps? What are your thoughts?

5 Likes

It might be possible to do that by hooking into the livecycle events of LV similar to this one: Phoenix LiveView browser loading spinner / https://twitter.com/_developit/status/1625612424576376840?s=12&t=r2wsZ3n1jFq2d8DsnGMu-Q · GitHub

Chris mentioned that liveview itself won’t include anything not yet standard though.

5 Likes

I started playing with view transitions after reading this post and decided to test it on LiveView. This chunk of code was enough to get it working.

The technique is not a standard yet, but it has a good usage %. Also, it’s a nice progressive enhancement, since it updates the DOM “the normal way” if the browser doesn’t support it.

Perhaps it could be a nice addition to LiveView, as it is very simple and allows developers to easily add complex animations when content changes.

9 Likes