loader
ImageLoader
Default: "({ src }) => src"
Extension of the native <img>
and <source>
elements. When loading images it is important to load assets matching the needed size, this is done using the loader
prop and setting sizes
.
<Imagealt="Masked woman with sticker on arm"height={552}src="/design-system/docs/images/example-image.jpg"width={754}/>
<Imagealt="Masked woman with sticker on arm"height={552}sizes="100vw"src="/design-system/docs/images/example-image.jpg"width={754}/>
Image with rounded corners
<Imagealt="Masked woman with sticker on arm"height={552}roundedsrc="/design-system/docs/images/example-image.jpg"width={754}/>
Pass loader
function to resolve src
to optimized URLs.
<Imagealt="Masked woman with sticker on arm"height={552}loader={function noRefCheck() {}}sizes="100vw"src="/design-system/docs/images/example-image.jpg"width={754}/>
Using the <Box as="picture">
and <ImageSource>
components to offer alternative versions of the image for art-direction. This will use the loader
and generate a srcSet
if specified. The <ImageSource>
's should go before the <Image>
.
<Box as="picture"><ImageSourceheight={512}loader={function noRefCheck() {}}media="(min-width: 512px)"sizes="100vw"src="/design-system/docs/images/example-512.svg"type="image/svg+xml"width={512}/><ImageSourceheight={375}loader={function noRefCheck() {}}media="(min-width: 375px)"sizes="100vw"src="/design-system/docs/images/example-375.svg"type="image/svg+xml"width={375}/><Imagealt="Masked woman with sticker on arm"height={552}loader={function noRefCheck() {}}sizes="100vw"src="/design-system/docs/images/example-320.svg"width={754}/></Box>
loader
ImageLoader
Default: "({ src }) => src"
width
number
height
number
quality
number
Quality passed to the loader
Default: 75
rounded
boolean
Corner style
Default: false
fetchpriority
"auto" | "high" | "low"
> Provides a hint of the relative priority to use when fetching the image. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Img#attr-fetchpriority
atoms
Applies permitted design system styles. See styling documentation for more.
loader
ImageLoader
Default: "({ src }) => src"
height
number
width
number
src
string
quality
number
Default: 75
atoms
Applies permitted design system styles. See styling documentation for more.