Who it is forA developer building an image generation screen where the final picture takes time and the layout must not jump.
The problemWithout a placeholder, the page layout shifts when the image arrives and users cannot tell that generation is still running.
The outcomeEach pending image shows a reserved frame with an animated placeholder and an accessible label, then gets replaced by the finished image.
What you need first
- Node.js and npm to install the package
- A React app using React 18 or newer
- A streaming or pending response source, such as a fetch endpoint, for the text and status cases
Steps
- Run
npm install generative-loadersin the project. - Import ImageLoader and the styles stylesheet from Generative Loaders.
- Render ImageLoader in the image slot with a variant such as skeleton or pixel-grid, a size, and a radius that matches your design.
- Keep the default label or pass your own label for the frame.
- Replace the ImageLoader with your image element when generation completes and check that the layout does not shift.
Prompt for your agent
In the generative-loaders repo, render ImageLoader in place of the pending image in <path-to-image-component> using a variant from the twelve image variants, sized to match the final image. Expected output: the code change and the variant name used. Verify that the frame keeps the same size before and after the real image replaces it.
Caveat. The README lists the image variants and default label but does not describe how the placeholder should be sized to match your generated image, so you must set size yourself.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for kasturibuilds/generative-loaders and "Reserve image frames while generated images load"
Add Deduped to Claude Code once
claude mcp add --transport http deduped https://dedupedai.com/mcp
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer