Backpack UI
Components
Image

Image

The Image component is a flexible, responsive image component. It supports aspect ratios, border-radius, variants, and SVG images. The component also includes lazy loading and can be used as a child component.


Image alternate

Import


_10
import { Image } from '@ef-global/backpack/Image';

Props

NameTypeDescription
srcstringThe image source URL.
aspectRatiosobjectAn object containing the aspect ratios for different breakpoints.
asChildbooleanA boolean to indicate whether the image should be rendered as a child component. Defaults to false.
radiusstringThe border-radius value.
variantstringThe box variant value.
inversebooleanA boolean to indicate whether the image should be displayed in inverse mode. Defaults to false.
classNamestringAdditional CSS classes.
altstringThe image alt text.
styleCSSPropertiesInline styles for the image.
loadedbooleanA boolean to indicate whether the image has been loaded. Defaults to false.

Examples

Default Example


Image alternate

_11
const DefaultExample = () => {
_11
return (
_11
<Image
_11
aspectRatios={{ s: '16/9', l: '1/1' }}
_11
radius='m'
_11
alt='Image alternate'
_11
src='https://a.storyblok.com/f/171771/4656x3492/bbf48d4721/wojciech-then-dija5f0vogq-unsplash.jpg'
_11
data-slot='Image'
_11
/>
_11
);
_11
};

AsSvg Example


Image alternate

_11
const AsSvg = () => {
_11
return (
_11
<Image
_11
aspectRatios={{ s: '1/1' }}
_11
radius='none'
_11
alt='Image alternate'
_11
src='https://placeholder.pics/svg/300.svg'
_11
data-slot='Image'
_11
/>
_11
);
_11
};