I'm working on a Vue.js application with tailwind styling. Within a flex parent container in my template, I have two child elements - one is always present, and the other is conditionally rendered using v-show.
The issue arises when the conditional element appears, causing the width of the first element to adjust automatically to accommodate the new space within the flex container. While this behavior is expected, I am looking to enhance it by adding a smooth animation to the width change of the first element, such as a sliding effect.
Here's a simplified version of my template structure:
<div>
<div
v-for="(group, groupName, index) in groups"
:key="groupName"
class="flex flex-row mb-2 relative"
>
<Transition
mode="in-out"
enter-from-class="-translate-x-[150%] opacity-0"
leave-to-class="-translate-x-[150%] opacity-0"
enter-active-class="transition duration-200"
leave-active-class="transition duration-200"
>
<div class="join join-vertical" v-show="buttonsVisibility[groupName]">
<!-- Conditionally rendered element -->
</div>
</Transition>
<div class="shadow-md rounded-lg collapse">
<!-- The element I would like to animate when the other element is shown/hidden -->
</div>
</div>
</div>
Current behavior:
https://i.sstatic.net/y3uqsV0w.gif
I'm seeking advice on how to achieve an animated transition effect for the specific element. Any help or suggestions would be highly appreciated!
I've attempted to use Vue's "Transition" component and Tailwind's transition properties for the dynamically changing width element without success.