CSS animation when adding new elements to the DOM

OK, how is the CSS-solution hacky? (not saying that its not, just saying that I’ve no idea)

1 Like

well, I didn’t say it’s hacky, I said I find it hackier than the one with phx-mounted. And I only used that word because you claimed that phx-mounted is “tweaks and hacks” :slight_smile:

What matters to me is that phx-mounted is simpler because:

  • I only touch one file, and all the code is in one place
  • I don’t have to write any CSS
  • I find it more readable*

*subjective

2 Likes

This code snippet by Sebb using phx-mounted and JS.transition should work. It currently doesn’t because of a bug in phoenix_live_view.js, for which I’ve submitted a bug report.

If that gets patched, it’s probably the simplest solution given a LiveView/Tailwind tech stack.

4 Likes