Layout

Motion · Next.js

Order history in a scrolling panel

Sort your orders and each one glides to its new place; open one and only the orders below it make room.

With Wardic: Solid 1 · Solid 2

Live demo

Your orders

Loading your orders…

Reduced motion: Orders re-sort, open and close at once; their pieces still fade.

Beside Wardic

Motion measures every layout element each time React renders it, so a re-sort needs nothing but the new order. Solid doesn't render a list again to move its rows, so Wardic is told about a change that moves elements without resizing any: wrap it in animateLayout, whose promise settles once they've all landed. Motion tells each row's layout animation starting and ending, so its list counts the rows on their way to know when it's done. And Motion needs layoutScroll on the scrolling panel, or a row opened lower down moves by however far the panel has scrolled; Wardic finds the scrolling containers itself.

The code

Highlighting…