Image

Enhanced image component with lazy loading and required alt text.

Quick Start

Installation
npm install @adaptavant/eds-core
Import
import { Image } from '@adaptavant/eds-core';

Object Fit

Controls how an image is resized to fit its container.

dogdog
<div className="grid gap-4 w-full grid-cols-2 [&>*]:aspect-square [&>*]:outline">
  {/* Cover */}
  <Image
    alt="dog"
    className="object-cover"
    src="https://picsum.photos/id/237/200/300"
  />

  {/* Contain */}
  <Image
    alt="dog"
    className="object-contain"
    src="https://picsum.photos/id/237/200/300"
  />
</div>

API Reference

Image

PropTypeDescriptionDefault
altstringDefines an alternative text description of the image._
srcstringThe image URL._
decoding?'sync' | 'async' | 'auto'Indicates how the image is decoded._
height?string | numberThe intrinsic height of the image._
loading?'eager' | 'lazy'Defines if the image should load immediately or defer until it is in view._
sizes?stringA set of source size descriptors for the image for responsive behavior._
srcSet?stringOne or more image source URLs for different resolutions._
width?string | numberThe intrinsic width of the image._
onError?(event: React.SyntheticEvent<HTMLImageElement, Event>) => voidThe intrinsic width of the image._

Style API

Our design system components include style props that allow you to easily customize different parts of each component to match your design needs.

Please refer to the Style API documentation for more insights.

Image parts

dog
<Image
    alt="dog"
    className="object-cover"
    src="https://picsum.photos/id/237/200"
    className="w-20"
  />

No parts available. Only root.