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
This is the list of props that you need to pass to the component.
getIcon
function(state: object) | optional, default icon is provided based on state object
This function decides what icon to show based on the current state of the component.
getMessage
function(icon: string, state: object) | optional, default message is provided based on the icon and state object.
This function decides what message to show based on the icon (returned from getIcon prop) and the current state of the component.
getUrl
function({}) | optional, no useful default
This function is called as soon as the component enters the viewport and is used to generate urls based on width and format if props.srcSet doesn't provide src field.
height
number | required
The Height of the image in px.
icons
object | required
This provides a map of the icons. By default, the component uses icons from material design, implemented as React components with the SVG element. You can customize icons
consticons={load: DownloadIcon,//...}
loader
string | optional, defaults to 'xhr'
This prop takes one of the 2 options, xhr and image. Read more about it here.
placeholder
object | required
This takes one of the 2 objects
// To add a solid color placeholder{color: ''}
or
/** * To add a low quality image * [Low Quality Image Placeholder](https://github.com/zouhir/lqip) * [SVG-Based Image Placeholder](https://github.com/technopagan/sqip) * base64 encoded image of low quality */{lqip: ''}
function({}) | optional, default function is provided which decides based on the device network.
This function decides if image should be downloaded automatically. The default function returns false for a 2g network,
for a 3g network it decides based on props.threshold and for a 4g network it returns true by default.
srcSet
array[srcType: object] | required
This provides an array of sources of different format and size of the image. Read more about it here.
The srcType has below structure
srcType={width: number,// requiredsrc: string,size: number,format: string,// one of the 'jpeg' or 'webp'}
theme
object | required
This provides a theme to the component. By default, the component uses inline styles, but it is also possible to use CSS modules and override all styles.