Image

This is a replacement for the <img /> and <figure /> tags. The idea is to have an image placeholder which will show the image when loaded and an optional caption.

<Image animate resources='/static/img/wallpaper.jpg'>
    The vast universe around us
</Image>

Providing resources according to viewport:

<Image animate resources={{
    small: '/static/img/small.jpg',
    medium: '/static/img/medium.jpg',
    large: '/static/img/large.jpg',
    xlarge: '/static/img/xlarge.jpg'
}}>
    The vast universe around us
</Image>
Prop nameTypeDefaultDescription
AnimationanyAnimationComponent
FrameanyFrameComponent
LoadinganyLoadingComponent
createLoaderanycreateLoaderModule
createResponsiveanycreateResponsiveModule
themeanyRequired
classesanyRequired
animatebool
showbooltrue
animationobject
layerenum'primary'
One of: 'primary', 'secondary', 'header', 'control', 'success', 'alert', 'disabled'
loadResourcesbooltrue

If the resources should be loaded.

resourcesunionRequired

The image resource or the images resources according to device viewport.

One of type: string, shape
i18nshape{ error: 'Image error', }

i18n messages.

error: string
imgPropsobject{}

Props to pass down to the <img /> element.

childrenany

If function, receives the animation status object.

Method nameParametersDescription
getDefaultState
loadResource

If enabled, load the resources provided. It doesn’t return the state of the loading, it will update the state.

Source code: src/Image Open in: Playground