Report a problem or share feedback← Catalog
Layout animation
curatedfreemotion/layout-animation
An example of animating a layout change using Motion for React's simple layout prop.
$
pnpm add motion # then adapt the free source from https://motion.dev/examples/react-layout-animationnpm deps: motion
Our notes
`layout` prop: elements animate to their new size/position when state changes (expanding cards, accordion rows, reflowing grids). No height hacks. Free example (motion is MIT); copy and adapt the source from the example page.
- Source
- Motion (motion.dev)
- Kind
- transition
- Categories
- transition
- Use as
- recipe — technique you apply to your own markup
- Applies to
- cardaccordiontable
- Motion
- on state · subtle · motion · low cost
- Tags
- motion
- 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
Similar
Compare all 4 →- Reorder animationmotion/reorder-itemsReorder: drag-to-reorder lists with automatic layout animation — settings lists, kanban columns, playlists. Free example (motion is MIT); copy and adapt the source from the example page.
- Accordion expandtransitions/accordionA disclosure / accordion / collapsible section whose panel grows and shrinks in height when toggled, with the header chevron flipping between a downward "v" and an upward "^". Use for settings groups, FAQs, filter sections, "show more" details — any header + collapsible body.
- Card resizetransitions/card-resizeTweening a container's width or height when its layout state changes (compact ↔ expanded card, collapsing panel, list row toggling extra detail). Pure CSS — no JS required beyond the class toggle that drives the size change.