Skip to content

API ​

FunctionImportPurpose
lazyLoadunlazyInitialize lazy loading with placeholder generation
autoSizesunlazyCalculate sizes attribute without lazy loading
triggerLoadunlazyProgrammatically load an image immediately
createPlaceholderFromHashunlazyGenerate PNG data URI from hash (client-side)
reportImageOutcomeunlazySet or clear data-error and call onImageLoad or onImageError for an image that loads its own sources
resolveImageAttributesunlazyResolve the <img> and <source> attributes, the lazyLoad options, and a loadKey of an UnLazyImage component from its props
createPngDataUriunlazy/blurhashGenerate PNG data URI from BlurHash (SSR)
createPngDataUriunlazy/thumbhashGenerate PNG data URI from ThumbHash (SSR)

Constants ​

ConstantImportPurpose
isCrawlerunlazyBoolean indicating if the current visitor is detected as a bot or crawler

Types ​

TypeImportPurpose
UnLazyLoadOptionsunlazyOptions for the lazyLoad function
TriggerLoadOptionsunlazyOptions for the triggerLoad function, which UnLazyLoadOptions extends
AutoSizesOptionsunlazyOptions for the autoSizes function
CreatePlaceholderFromHashOptionsunlazyOptions for the createPlaceholderFromHash function
UnLazySourceunlazy and every adapter packageOne <source> of the sources prop
UnLazyImagePropsunlazyProps every UnLazyImage component shares
UnLazyImageAttributesunlazyReturn type of resolveImageAttributes

Released under the MIT License.