Skip to main content
The Image component provides automatic image optimization, responsive sizing, and lazy loading. vinext routes local images through /_vinext/image and uses @unpic/react for CDN-hosted images.

Import

Basic Usage

API Reference

Props

string | StaticImageData
required
Image source URL or imported image.Supports:
  • Remote URLs (validated against remotePatterns)
  • Local paths (/images/photo.jpg)
  • Static imports (import img from './img.png')
string
required
Alternative text for accessibility.Required — omitting this prop will cause a build error.
number
Intrinsic width in pixels.Required unless using fill or importing a static image:
number
Intrinsic height in pixels.Required unless using fill or importing a static image:
boolean
default:"false"
Fill the parent container (replaces layout="fill").Sets position: absolute and sizes to fill the parent:
number
default:"75"
Image quality (1-100).Higher values = better quality, larger file size:
boolean
default:"false"
Load the image with high priority (disables lazy loading).Use for above-the-fold images:
Sets loading="eager" and fetchpriority="high".
'blur' | 'empty'
default:"'empty'"
Placeholder shown while the image loads.
  • 'blur' — requires blurDataURL
  • 'empty' — transparent placeholder
string
Data URL for blur placeholder (must start with data:image/).Automatically provided by static imports:
(params) => string
Custom URL builder for CDN transforms.
string
Responsive size hints for the browser.
boolean
default:"false"
Skip image optimization (serve original file).
'lazy' | 'eager'
default:"'lazy'"
Browser loading strategy.Automatically set to 'eager' when priority={true}.

Standard Img Props

All standard <img> attributes are supported:

Remote Patterns

Configure allowed remote image hosts in next.config.js:
Unconfigured remote URLs are:
  • Dev: Warning logged, image still loads
  • Production: Blocked with error

Optimization

Local Images

Routed through /_vinext/image?url=/path&w=800&q=75:
  • Dev mode: Serves original file (passthrough)
  • Cloudflare Workers: Uses Cloudflare Images binding for resize/transcode
  • Custom: Implement your own handler

Remote Images (CDN)

Uses @unpic/react to generate CDN-specific URLs:
Supported CDNs: Cloudinary, imgix, Cloudflare Images, Vercel, and more.

Responsive Images

Generates srcset with standard breakpoints:
Breakpoints: [640, 750, 828, 1080, 1200, 1920, 2048, 3840]

Static Imports

Importing images provides automatic width/height:

getImageProps

For advanced use cases (art direction, <picture> elements):

Security

Blur Data URL Sanitization

vinext validates blurDataURL to prevent CSS injection:

Remote Pattern Validation

All remote URLs are validated against configured patterns. Missing configuration blocks production requests.

Limitations

layout prop: Deprecated in Next.js 13+. Use fill instead of layout="fill".
Server-side optimization: vinext does not perform image optimization at build time (no static generation of multiple sizes).

Source

View source code → Implementation: /home/daytona/workspace/source/packages/vinext/src/shims/image.tsx