I need to add a transition to a margin on an element with Tailwind. I want the margin to do a transition smoothly.
<div
id="thumb"
className={`transition-spacing duration-300 ease-in-out ${switchState ? "ml-auto" : "mr-auto"}`}
>
</div>
Now it just instantly switches the margin from mr-auto to ml-auto without a transition. Here is my tailwind config for the transitions:
transitionProperty: {
width: 'width',
spacing: 'margin, padding',
}
I can verify that the switchState works. Why doesn't the transition work?