Commented on phantom-ui · May 5, 2026
Thanks, good questions. 1. Responsive layouts: yes, it handles them. While loading is true, phantom-ui keeps a ResizeObserver and MutationObserver active. Any time CSS reflows the layout (breakpoint change, font load) it re-measures on the next requestAnimationFrame. If your framework swaps mobile/desktop components on a media query, the MutationObserver catches the DOM swap and re-runs. 2. Unknown image aspect ratios: the lib skips zero-size elements by default, but listens for image load events and re-measures once the browser has the natural dimensions. So the shimmer block shows up as soon as the image starts having a size. If you need the skeleton before the image even starts loading, set explicit width/height on the (or use CSS aspect-ratio). There's also an escape hatch with data-shimmer-width="..." data-shimmer-height="..." to force dimensions on a still-empty element. The stagger and count attributes were the two things I kept wanting in other libs without ever finding a clean API for, so I made them first-class. If you try it on a project, ping me with whatever edge cases you hit. That's how every iteration so far has improved.