Filter Grid Reflow
A result grid where the survivors of a filter visibly travel to their new positions instead of teleporting.
9 of 9
Build a filterable result grid whose remaining cards travel to their new positions. Structure: a row of filter chips above a 3-column grid of square cards. The whole component is one behavior: when the filter changes, the cards that survive must ANIMATE to their new positions rather than jump. Wrap the grid in AnimatePresence with mode="popLayout" and give each card a `layout` prop, keyed by a stable id. - Removed cards exit by fading to 0 and scaling to 0.7. - Surviving cards travel to their new grid slots on a spring (stiffness ~380, damping ~30). Use a spring rather than a fixed duration: cards move different distances, and a spring lets each take the time its own distance needs. - mode="popLayout" matters here - it removes exiting cards from layout immediately, so the survivors start moving right away instead of waiting for the exit to finish. Filter chips: the active one is FILLED with the accent color, not merely outlined. At chip size an outline change is close to invisible, and this has to be readable in the two seconds anyone gives it. Set aria-pressed on each chip. Below the grid, a count ("4 of 9") with aria-live="polite". Under prefers-reduced-motion, turn the layout animation off entirely and let cards fade in and out in place. Sliding cards is exactly the motion that setting exists to remove. Colors as tokens: paper cards, hairline borders, one accent for the active chip. Build the component, not this demo of it. - Ambient motion that IS the component may loop: a drifting background, a marquee, a spinner while something is genuinely loading. - Do not add any timer, interval, loop or script that performs a person's action by itself. No auto-hover, no auto-click, no cycling through states, no pretend submitting, no replaying the interaction on a schedule. - Every state that answers a person waits for a real event from that person. - Placeholder copy and sample content are welcome. Simulated behaviour is not.