How to add transitions/animations to e.g. table rows? #1396
Unanswered
brendan-morin
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone, I'm looking for some basic ideas for how to add animations or transitions to flowbite-svelte table rows. Let's say I have a table like this:
And it renders something like this (the picture has some more features, but the above code should be accurate enough to get the point):
If a user inserts a new row, deletes a row, or some action triggers row reordering, I call
invalidateAll()
and it fetches new data, which should reflect the updated order, provided by the server. My goal is to animate this with some smoother transitions.One challenge I'm running into is that svelte doesn't allow transitions or animations on components (e.g.
Transitions can only be applied to DOM elements, not components svelte(invalid-transition)
). Adding divs to wrap these components (similar to this discussion) in the context of a table does create the desired transitions, but creates layout issues. For example, if I try to just wrap the rows like this:Then we end up having display issues with the row widths, and other problems (horizontal lines, etc):
Is there any recommended workaround that could be employed to allow these transitions without messing up the table behavior?
Beta Was this translation helpful? Give feedback.
All reactions