Phantom UI – Skeleton that measures your real DOM (Web Component, 8kb)
at github.com▼1 up and 0 down, posted by
1 up and 0 down, posted by
Kinda cool.. but you need to have placeholder values while loading, as well as assuming you aren't using a UI toolkit that already includes a skeleton component wrapper.
If user is undefined, then {user.name} renders nothing and the element has zero size. In that case you do need a fallback like {user?.name ?? "x"} so the element has dimensions to measure. But it's not "placeholder data" in the traditional sense, it's just ensuring the DOM element exists and has a size. The text is invisible during loading anyway. For static layouts (headings, labels, images with width/height), it works with no fallbacks at all. The structure itself is the skeleton.