-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Closed
Labels
Image (next/image)Related to Next.js Image Optimization.Related to Next.js Image Optimization.
Description
Describe the feature you'd like to request
- If I have a desktop image and a mobile image,
next/image
will only load the mobile or desktop image accordingly - If I add
priority
, then both the mobile and desktop images will load in all cases - Omitting
priority
impacts my LCP, addingpriority
means the user has to download an additional large image - I would like to be able to specify that an image should only be visible at a certain media-query
Describe the solution you'd like
Example
<>
{/* I only load on mobile */}
<Image
alt="Picture of the author"
media="(max-width: 699px)"
height={500}
priority
src="me-mobile.jpg"
width={500}
/>
{/* I only load on desktop */}
<Image
alt="Picture of the author"
media="(min-width: 700px)"
height={500}
priority
src="me-desktop.jpg"
width={500}
/>
</>
Describe alternatives you've considered
Manually creating an img
tag with sizes
or source
and specifying media-queries there
guitheengineer
Metadata
Metadata
Assignees
Labels
Image (next/image)Related to Next.js Image Optimization.Related to Next.js Image Optimization.