-`sizes` - Defines what proportion of the screen you expect the image to take up. Recommended, as it helps serve the correct sized image to each device. [More info](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-sizes).
-`sizes` - Defines what proportion of the screen you expect the image to take up. Recommended, as it helps serve the correct sized image to each device. [More info](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-sizes).
-`quality` - The quality of the optimized image, an integer between 1 and 100 where 100 is the best quality. Default 75.
-`quality` - The quality of the optimized image, an integer between 1 and 100 where 100 is the best quality. Default 75.
-`loading` - The loading behavior. When `lazy`, defer loading the image until it reaches a calculated distance from the viewport. When `eager`, load the image immediately. Default `lazy`. [More info](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-loading)
-`loading` - The loading behavior. When `lazy`, defer loading the image until it reaches a calculated distance from the viewport. When `eager`, load the image immediately. Default `lazy`. [More info](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-loading)
-`priority` - When true, the image will be considered high priority and [preload](https://web.dev/preload-responsive-images/).
-`priority` - When true, the image will be considered high priority and [preload](https://web.dev/preload-responsive-images/). Should only be used when the image is visible above the fold.
-`unoptimized` - When true, the source image will be served as-is instead of resizing and changing quality.
-`unoptimized` - When true, the source image will be served as-is instead of changing quality, size, or format.
-`unsized` - **Deprecated** When true, the `width` and `height` requirement can by bypassed. Use the `layout` property instead!
-`unsized` - **Deprecated** When true, the `width` and `height` requirement can by bypassed. Use the `layout` property instead!
All other properties on the `<Image>` component will be passed to the underlying `<img>` element.
All other properties on the `<Image>` component will be passed to the underlying `<img>` element.
@@ -23,6 +23,8 @@ Instead of optimizing images at build time, Next.js optimizes images on-demand,
...
@@ -23,6 +23,8 @@ Instead of optimizing images at build time, Next.js optimizes images on-demand,
Images are lazy loaded by default. That means your page speed isn't penalized for images outside the viewport. Images load as they are scrolled into viewport.
Images are lazy loaded by default. That means your page speed isn't penalized for images outside the viewport. Images load as they are scrolled into viewport.
Images are always rendered in such a way as to avoid prevent [Cumulative Layout Shift](https://web.dev/cls/), a [Core Web Vital](https://web.dev/vitals/) that Google is going to [use in search ranking](https://webmasters.googleblog.com/2020/05/evaluating-page-experience.html).
## Image Component
## Image Component
To add an image to your application, import the [`next/image`](/docs/api-reference/next/image.md) component:
To add an image to your application, import the [`next/image`](/docs/api-reference/next/image.md) component:
...
@@ -48,14 +50,11 @@ function Home() {
...
@@ -48,14 +50,11 @@ function Home() {
exportdefaultHome
exportdefaultHome
```
```
-`width` and `height` are required to prevent [Cumulative Layout Shift](https://web.dev/cls/), a [Core Web Vital](https://web.dev/vitals/) that Google is going to [use in their search ranking](https://webmasters.googleblog.com/2020/05/evaluating-page-experience.html)
[View all properties](/docs/api-reference/next/image.md) available to the `next/image` component.
-`width` and `height` are automatically responsive, unlike the HTML `<img>` element
-`quality` can be configured per image, default 75
- See [`next/image`](/docs/api-reference/next/image.md) for list of available props.
## Configuration
## Configuration
You can optionally configure Image Optimization by using the `images` property in`next.config.js`.
In addition to [using properties](/docs/api-reference/next/image.md) available to the `next/image` component, you can optionally configure Image Optimization for more advanced use cases via`next.config.js`.
If no configuration is provided, the following default configuration will be used.
If no configuration is provided, the following default configuration will be used.
...
@@ -127,11 +126,11 @@ module.exports = {
...
@@ -127,11 +126,11 @@ module.exports = {
The following Image Optimization cloud providers are supported:
The following Image Optimization cloud providers are supported:
- When using `next start` or a custom server image optimization works automatically.
-[Vercel](https://vercel.com): Works automatically when you deploy on Vercel, no configuration necessary. [Learn more](https://vercel.com/docs/next.js/image-optimization)
-[Vercel](https://vercel.com): Works automatically when you deploy on Vercel, no configuration necessary.