Optimized Image

PRO

Image component with lazy loading, blur placeholder, graceful fallback and a built-in lightbox. Plug in a `loader` to route every request through your own image service and get a real responsive srcSet.

Pro Features

Unlock advanced capabilities with the Pro version

Lightbox Preview

Open images in a built-in zoomable lightbox on click

Graceful Fallback

Show a fallback image when the source fails to load

Hover Controls

Zoom, download and image-info controls on hover

Bring Your Own Loader

Route every request through your image service — Cloudinary, ImageKit, /_next/image or a custom endpoint

Responsive Images

Generate a srcSet from the width prop (0.5x / 1x / 1.5x / 2x) once a loader is supplied

Lazy Loading

Load images only when they enter the viewport

Blur Placeholder

Show a blur skeleton placeholder while the image loads

Installation

Install via CLI

npx @moontra/moonui-cli add optimized-image

Usage

Pro Required
Optimized hero image
Click to enlarge

Examples

Responsive Image Gallery

PRO

Automatically optimized images for different screen sizes

Pro Required
Gallery image 1
Gallery image 2
Gallery image 3
Gallery image 4
Gallery image 5
Gallery image 6
Gallery image 7
Gallery image 8

Progressive Loading with Blur Placeholder

PRO

Show blur placeholder while loading high-quality images

Pro Required
Progressive loading demo

Loading HD Image...

Custom Image Loader (format & quality)

PRO

`format` and `quality` are inert on their own — they take effect only through a `loader`, which is the function that actually builds the URL. Pick a format below and watch the generated URL change.

Pro Required
quality: 90
Custom loader demo
https://picsum.photos/seed/moonui/800/400?q=90&fm=webp

Device-Specific Optimization

PRO

With a `loader` in place, `width` seeds a real srcSet (0.5x / 1x / 1.5x / 2x) and `sizes` tells the browser which candidate to pick. Without a loader no srcSet is emitted at all — pass `srcSet` yourself instead.

Pro Required

Mobile

640px

Tablet

1024px

Desktop

1920px
Device optimized image