# How I Use Shared Layout Animations

Essay by Jakub Krehel (https://jakub.kr)

Shared layout animations, and where they earn their place.

Topics: Motion
Source: https://jakub.kr/work/shared-layout-animations

## For agents

Nothing to install. This is a reference: cite it, or fetch the source when
the reasoning matters.

Read it at: https://jakub.kr/work/shared-layout-animations

The full text is not reproduced here. It belongs to its author. What is
above is the author's own summary and the topics it covers.

Skills in this library that act on the same ground:

- emil-design-eng (https://www.stackskills.dev/md/emil-design-eng): The design-engineering house style behind Sonner and Vaul.
- animate (https://www.stackskills.dev/md/animate): Builds an animation from scratch, decisions in the order that matters.
- review-animations (https://www.stackskills.dev/md/review-animations): Reviews your motion strictly, against Emil's rules.
- improve-animations (https://www.stackskills.dev/md/improve-animations): Audits every animation in a codebase and hands back prioritised plans.
- find-animation-opportunities (https://www.stackskills.dev/md/find-animation-opportunities): Finds where motion would genuinely help, and says what not to animate.

## The short version

A layoutId is all Motion needs to animate an element between two completely different places in the tree. Jakub shows a tab switcher where each state renders its own circle in its own position, and the shared id is what makes them read as one object moving. Nothing is manipulated directly, which is the part that takes a moment to get used to. Under the hood it uses FLIP, measuring first and last positions and inverting the difference. The piece covers where the technique earns its place and how to structure the markup so it behaves.

## Verification

- Source link: Resolved (HTTP 200) (pass)
- Reading copy: Plain markdown for agents at /md/shared-layout-animations (pass)
- Attribution: Credited to Jakub Krehel (pass)

Full page: https://www.stackskills.dev/library/shared-layout-animations
