Progressive Image Loading

Images that develop from a blur, color, or shimmer placeholder, without layout shift.

imageplaceholderblurhashlazy loadingblur upskeletonnext/image
Progressive Image Loading component preview

Overview

Progressive Image Loading is a free React and Tailwind CSS image component that shows a placeholder until the photo arrives, in Next.js or any React app, with no dependencies. Use a BlurHash or tiny preview that blurs up into the image, a fill in its main color, or a shimmer. The frame holds the aspect ratio, so nothing shifts as it lands, and the photo develops from a soft blur to full sharpness. Cached images appear at once, failures show the alt text, and reduced motion uses a short fade. Pass as={Image} to render through next/image.

Installation

Run the following command

~/your-project
pnpm dlx wensity@latest add progressive-image-loading

Usage

Import ProgressiveImageLoading from @/components/wensity/progressive-image-loading and render it anywhere in your React or Next.js app. The source lands in your own repo, so every prop, class and animation below is yours to edit.

app/example.tsx
import { ProgressiveImageLoading } from "@/components/wensity/progressive-image-loading";
export default function Example() {
return (
<ProgressiveImageLoading
src="https://assets.wensity.com/photos/landscape/alpine-lake-reflection.webp"
alt="Mountains reflected in a still lake"
width={1672}
height={941}
blurhash="LVBE5lkYR3Rk.AtRWAa$.Aoznhog"
className="max-w-xl rounded-2xl"
/>
);
}

Props

PropTypeDefaultDescription
srcstring-Image url. While it is missing the placeholder stays up, for urls that arrive later.
altstring-Alternative text, required. Also shown in the error state.
rationumber-Width over height, such as 4 / 3. Reserves the space before the image loads.
width / heightnumber-Intrinsic size. Sets the ratio when ratio is omitted, and is passed on to next/image.
placeholder"blur" | "color" | "shimmer"-Which placeholder to show. Defaults to blur with a BlurHash or preview, else color with a color, else shimmer.
blurhashstring-BlurHash string for the blur placeholder, and the source of the main color. Decoded in the component.
blurDataURLstring-Tiny preview image for the blur placeholder, such as a 20px wide data URL.
colorstring-Main color of the photo, for the color placeholder.
durationnumber700Length of the develop animation, in milliseconds.
loading"lazy" | "eager""lazy"Native lazy loading.
asReact.ElementType"img"Render the image through another component, such as next/image.
imagePropsobject-Extra props for the image element, such as priority, or fill for next/image when only ratio is set.
imageClassNamestring-Classes for the image itself, such as object-position.