r/reactjs • u/Brottin • Oct 26 '26
Arrivo: loading states for React that play where your content will land, then hand the real elements back
Skeleton screens always felt like a guess to me: grey bars in roughly the right shape, then the real content pops in somewhere slightly different.
So I built Arrivo. While loading is true, an effect plays exactly where your content will land. When it turns false, the real elements are revealed in place.
Demo : https://tuancuongpham.github.io/arrivo/
Code: https://github.com/tuancuongpham/arrivo
npm i u/brottin/arrivo
import { Reveal } from '@brottin/arrivo';
import { halftone } from '@brottin/arrivo/effects';
<Reveal effect={halftone} loading={isLoading}>
<ArticleCard post={post} />
</Reveal>
How it works:
- Your content stays in the DOM, hidden with
visibility, so nothing shifts when it lands. - Each wrapper gets one canvas overlay. Text lines are measured with Range rects and images are read from the page, so the effect draws the real shape of your content instead of a guess.
- An effect is two draw functions,
idle()andreveal(p). One shared requestAnimationFrame loop drives every instance, off-screen ones pause, and reduced motion turns every reveal into a 150 ms fade. - Zero runtime dependencies, about 8.5 KB gzipped for the core and 0.7 to 3.4 KB per effect, tree-shaken.
The 13 effects: split-flap, redacted, quadtree mosaic, CMYK halftone, CRT tune-in, ink (with 8 threshold maps), particle swarm, darkroom, Tetris, fuse (with a Lunar New Year mode), equalizer, thermal and snowfall.
It's 0.1.0, so feedback is very welcome, especially on where you'd actually use something like this and where it would be too much.
13
u/dbbk Oct 26 '26
These are really bad. Why would you make it so much slower to show the real content?
7
u/amayle1 Oct 26 '26
But if the content isn’t loaded, how does it actually know the shape? Aka text could be two lines or three, there’s no way to know until the actual content is client side.
Also the reveal animations are obnoxious. Form over function.
4
u/sohnya_u Oct 26 '26
Just use a spinner, problem solved.
1
u/DeadCEO Oct 28 '26
the mismatch between skeleton shape and real content is the annoying part, after a while you just learn to ignore the grey bars. playing the loading state exactly where the content lands is a much better idea. how does it know the landing spot - do you measure the element after mount, or does the developer pass the target ref explicitly?