r/reactjs • u/quintin331 • May 12 '26
Show /r/reactjs Spent years fixing grey skeleton divs. Built this npm package so nobody has to again.
Every time I built a skeleton loader, it was the same pain: copy the card, replace content with grey boxes, tweak padding after every design change, watch all the shimmer animations run out of sync like a broken disco floor.
So I built shimmer-trace, a React library that wraps your real component and automatically traces the shape of every element to generate a perfectly matched skeleton. One wrapper, zero hand-drawn boxes.
<Shimmer loading={isLoading}>
<UserCard user={user} />
</Shimmer>
That's literally it. No <SkeletonCard />. No fake grey divs.
- π Live demo: https://jeetvora331.github.io/shimmer-trace/
- π¦ npm: https://www.npmjs.com/package/shimmer-trace
- β GitHub: https://github.com/jeetvora331/shimmer-trace
0
Upvotes
3
u/RaltzKlamar May 12 '26
If I were to use this for a UserCard like how you show on the website, I still need to put in some kind of placeholder data to get it to read the elements, right? How does it handle tracing multi-line text elements?
If I had a view with several card components that loads all at once, could I put this at the top of the view and it would render the skeletons of each card, or does it only trace down a finite number of elements in the tree?
This does look really nice, but I'm curious as to what the limitations or edge cases are.
1
u/joseph_earl May 12 '26
How does this work when the component requires a prop but the prop value is undefined while loading it?
The only place that covers this is the ShimmerSuspense which does require a separate skeleton component or the component to integrate with the shimmer library.
I think your examples for the normal Shimmer are too contrived - why would you show a loading shimmer if you already have the data available - and if you donβt have the data then I suspect this library requires a skeleton or integration with the shimmer library as it does for suspense, in which case I think the main advantage compared to other libraries goes away.