You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
:warning: It is important that you pass on the ref in placeholder, otherwise the detection of the element intersecting is impossible. :warning:
118
+
117
119
Note that while you can set the rendered components to be anything you want, you most likely want to use the same `src`, `srcSet` and `alt` attributes in an `<img>` eventually.
118
120
To keep this consistent, and reduce repetition, the render callbacks pass those attributes back to you.
119
121
@@ -139,12 +141,12 @@ Thus, whether you want to display a simple `<img>`, your own `<Image>`, or even
139
141
alt="Buildings with tiled exteriors, lit by the sunset."
140
142
// This is rendered first, notice how the src is different
| **src** | String | | true | The source of the image to load |
412
-
| **alt** | String | | false | The alt text description of the image you are loading |
413
-
| **srcSet** | String | | false | If your images use srcset, you can pass the `srcSet` prop to provide that information for preloading. |
414
-
| **sizes** | String | | false | If your images use srcset, the sizes attribute helps the browser decide which source to load. |
415
-
| **actual** | Function (render callback) of type ({src, alt, srcSet}) => React.ReactNode | | true | Component to display once image has loaded |
416
-
| **placeholder** | Function (render callback) of type ({alt}) => React.ReactNode | undefined | false | Component to display while no request for the actual image has been made |
417
-
| **loading** | Function (render callback) of type () => React.ReactNode | placeholder | false | Component to display while the image is loading |
418
-
| **error** | Function (render callback) of type () => React.ReactNode | actual (broken image) | false | Component to display if the image loading has failed (render prop) |
419
-
| **loadEagerly** | Boolean | false | false | Whether to skip checking for viewport and always show the 'actual' component |
420
-
| **observerProps** | {threshold: number, rootMargin: string} | {threshold: 0.01, rootMargin: "50px0px"} | false | Subset of props for the IntersectionObserver |
413
+
| Name | Type | Default | Required | Description |
| **src** | String | | true | The source of the image to load |
416
+
| **alt** | String | | false | The alt text description of the image you are loading |
417
+
| **srcSet** | String | | false | If your images use srcset, you can pass the `srcSet` prop to provide that information for preloading. |
418
+
| **sizes** | String | | false | If your images use srcset, the sizes attribute helps the browser decide which source to load. |
419
+
| **actual** | Function (render callback) of type ({imageProps}) => React.ReactNode | | true | Component to display once image has loaded |
420
+
| **placeholder** | Function (render callback) of type ({imageProps, ref}) => React.ReactNode | undefined | true | Component to display while no request for the actual image has been made |
421
+
| **loading** | Function (render callback) of type () => React.ReactNode | placeholder | false | Component to display while the image is loading |
422
+
| **error** | Function (render callback) of type () => React.ReactNode | actual (broken image) | false | Component to display if the image loading has failed (render prop) |
423
+
| **loadEagerly** | Boolean | false | false | Whether to skip checking for viewport and always show the 'actual' component |
424
+
| **observerProps** | {threshold: number, rootMargin: string} | {threshold: 0.01, rootMargin: "50px0px"} | false | Subset of props for the IntersectionObserver |
421
425
422
426
**`<LazyImageFull />`** accepts the following props:
| **src** | String || true | The source of the image to load |
427
-
| **alt** | String || false | The alt text description of the image you are loading |
428
-
| **srcSet** | String || false | If your images use srcset, you can pass the `srcSet` prop to provide that information for preloading. |
429
-
| **loadEagerly** | Boolean | false| false | Whether to skip checking for viewport and always show the 'actual' component |
430
-
| **observerProps** | {threshold: number, rootMargin: string} | {threshold: 0.01, rootMargin: "50px0px"} | false | Subset of props for the IntersectionObserver |
431
-
| **children** | Function of type ({imageProps, imageState}) => React.ReactNode | | true (or `render`) | Function to call that renders based on the props and state provided to it by LazyImageFull |
| **src** | String || true | The source of the image to load |
431
+
| **alt** | String || false | The alt text description of the image you are loading |
432
+
| **srcSet** | String || false | If your images use srcset, you can pass the `srcSet` prop to provide that information for preloading. |
433
+
| **loadEagerly** | Boolean | false| false | Whether to skip checking for viewport and always show the 'actual' component |
434
+
| **observerProps** | {threshold: number, rootMargin: string} | {threshold: 0.01, rootMargin: "50px0px"} | false | Subset of props for the IntersectionObserver |
435
+
| **children** | Function of type ({imageProps, imageState, ref}) => React.ReactNode | | true | Function to call that renders based on the props and state provided to it by LazyImageFull |
432
436
433
437
[You can consult Typescript types in the code](./src/LazyImage.tsx) for more context.
0 commit comments