design-infraGitHub
Report a problem or share feedback← Catalog

Shared layout animation

curatedfree

motion/shared-layout-animation

An example of a shared layout animation, where two elements are animated from one to the other, using Motion for React's simple layoutId prop.

state — subtlerecipeRefinedMinimalPlayful
$pnpm add motion # then adapt the free source from https://motion.dev/examples/react-shared-layout-animation

npm deps: motion

Our notes

Shared-element layoutId: a tab underline / pill that glides between items. The free, hand-rolled way to animate tabs, nav highlights and segmented controls — about 10 lines with `layoutId`. Free example (motion is MIT); copy and adapt the source from the example page.
Shared layout animation preview
Source
Motion (motion.dev)
Kind
transition
Categories
transition
Use as
recipe — technique you apply to your own markup
Applies to
tabsnavigationbutton
Motion
on state · subtle · motion · low cost
Tags
motion, AnimatePresence, animate, layoutId
Licence
motion / motion/react / motion-v are MIT. Motion+ (premium components, example source, AI Kit pro tools) is paid — one-time Personal licence or per-seat Business.
Live demo
motion.dev
Docs
motion.dev