EOS UI
Components

Image

An image component for responsive media, lazy loading, BlurHash placeholders, and explicit loading states.

Import

import '@eosjs/ui/image';

Introduction

Image is a framework-agnostic Web Component for responsive media. It preserves the native image model while adding lazy loading, BlurHash placeholders, loading feedback, and explicit fallback states.

Basic Usage

Use the controls in this example to inspect the supported image states and layout options.

Basic usage

Loading image…

Fallback

Use the error slot to provide recovery-oriented content when the image cannot be loaded.

Image unavailable

Responsive and circular images

responsive lets the image follow the available inline size. circle clips the image to a circle while preserving the declared dimensions.

API

Generated from custom-elements.json for eos-image.

Attributes

NameTypeDefaultDescription
src———
src-type———
alt———
width———
height———
loading———
crossorigin———
object-fit———
placeholder———
placeholder-type———
placeholder-fill———
show-delay———
responsive———
circle———

Events

NameTypeDescription
blurhash-errorCustomEvent—

Attributes

AttributeTypeDefaultDescription
srcstring—Image URL or BlurHash string
src-typeurl | blurhashurlHow to interpret src
altstring—Alternative text for the image
width / heightstring—Host dimensions; defaults to 100px and can be sized below 100px
loadinglazy | eagereagerWhether to wait for viewport visibility
crossoriginstring—Native cross-origin image setting
object-fitcover | contain | fill | none | scale-downcoverNative image fitting mode
placeholderstring—Placeholder URL or BlurHash
placeholder-typeurl | blurhashurlHow to interpret the placeholder
placeholder-fillbooleanfalseKeep the placeholder as a background layer
show-delaystring0Delay before revealing a loaded image, in milliseconds
responsivebooleanfalseMake the image follow its container width
circlebooleanfalseClip the image to a circle

Events

load and error use native event names. progress is the component's structured network-progress event.

EventWhen it firesevent.detail
loadThe image is ready to display—
errorThe image failed to load—
progressNetwork data is received{ loaded, total, src }

Slots

<eos-image src="/cover.jpg" style="width: 320px; height: 200px">
  <span slot="loading">Preparing image…</span>
  <span slot="error">Image unavailable</span>
</eos-image>

On this page