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'— requiresblurDataURL'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 innext.config.js:
- 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:
Responsive Images
Generatessrcset with standard 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 validatesblurDataURL to prevent CSS injection:
Remote Pattern Validation
All remote URLs are validated against configured patterns. Missing configuration blocks production requests.Limitations
Source
View source code → Implementation:/home/daytona/workspace/source/packages/vinext/src/shims/image.tsx