<NuxtPicture> is a drop-in replacement for the native <picture> tag.
Usage of <NuxtPicture> is almost identical to <NuxtImg> but it also allows serving modern formats like webp when possible.
Learn more about the <picture> tag on MDN.
Setup
In order to use<NuxtPicture> you should install and enable the Nuxt Image module:
Usage
<NuxtPicture> outputs a native <picture> tag with multiple <source> elements for different formats and a fallback <img> tag:
Props
<NuxtPicture> accepts all native <picture> and <img> attributes plus additional props for image optimization:
string
required
The source URL of the image.
number
The width of the image in pixels. Used for image optimization.
number
The height of the image in pixels. Used for image optimization.
string
Responsive sizes for different viewport widths. Example:
"sm:100vw md:50vw lg:400px"string
Alternative text for the image. Important for accessibility.
string
Comma-separated list of formats to generate (e.g.,
"webp,avif,png").number
The quality of the optimized image (0-100).
'lazy' | 'eager'
Native lazy loading attribute.
string
The image provider to use (e.g.,
"cloudinary", "imgix", "ipx").string
A predefined set of image modifiers.
object
Additional attributes to apply to the
<img> element.Learn More
NuxtPicture Documentation
Read the complete documentation for
<NuxtPicture> component in the Nuxt Image module docs.