Skip to content

Image ​

The Image component is used to display images and supports various fitting modes. Below is an example of how to use the Image component.

Usage Example ​

Default Slot ​

The OlImage component supports a default slot, allowing customization of the display content in error states.

Lazy Loading ​

The OlImage component supports lazy loading. By setting the loading attribute to 'lazy', images are loaded only when they enter the viewport, improving page performance.

Attributes ​

Attribute NameDescriptionTypeDefault Value
srcImage source URLstring-
fitImage fit mode'fill' | 'contain' | 'cover' | 'none' | 'scale-down''fill'
loadingImage loading mode'eager' | 'lazy''eager'
altImage alt textstring-

Slots ​

Slot NameDescription
errorContent displayed when image fails to load
placeholderContent displayed while image is loading