motion icon indicating copy to clipboard operation
motion copied to clipboard

[FEATURE] A way to control transition when using layoutId

Open tounsoo opened this issue 10 months ago • 2 comments

Is your feature request related to a problem? Please describe. I'm frustrated that the indicators are animating vertically when other elements are resizing when using layoutId. I have a tab with indicator similar to the example in the doc.

Describe the solution you'd like A way to limit x or y animation when using layoutId

Describe alternatives you've considered

  • Tried adding layout to the wrapper which isn't ideal since that will animate the entire component vertically.
  • Changed parent div to motion.div with layout and transition={{ duration: 0 }}, this worked

Additional context You can replicate what I'm frustrated with by adding a div on top of the Tab in the example and changing its height on click without animation.

Div will change its height instantly while the indicator will float outside of the Tab and animate to its position

tounsoo avatar Mar 07 '25 21:03 tounsoo

HUGE +1 to this. I am surprised there is no way to control / override the individual properties that get animated during layout transitions.

Here's a CodeSandbox that shows the issue: https://codesandbox.io/p/sandbox/sn25nh (Click on "Expand" to see how the tab highlight unexpectedly moves vertically.)

benface avatar Apr 17 '25 20:04 benface

Oh, this seems like a duplicate of #1972.

benface avatar Apr 17 '25 20:04 benface