Skip to content

<sessions-image>

An image with an accessible description.

Preact & React<Image>GroupActionsDrawn asImage

Preview

Drawn by the same renderers Sessions uses for your extension, from the DOM example beside it, without its event handlers.

When to use it

Pass intrinsic width and height (or an aspect-ratio) so the host reserves space before the image loads.

In Preact and React, import the component of the same name from @sessions/apps/preact or @sessions/apps/react. Attributes become camelCase props, a boolean attribute is a boolean prop, and an event is an on prop that receives the event’s detail.

Attributes

Attribute
srcrequired
The image URL.Prop src
altrequired
The accessible description.Prop alt
width
Intrinsic width in pixels.Prop width
height
Intrinsic height in pixels.Prop height
aspect-ratio
A forced aspect ratio, e.g. 1.5.Prop aspectRatio
fit
How the image fills its box.covercontainProp fit
mutedboolean
Grayscale and dimmed — a logo for something not connected yet. Removing it animates the image back to full colour.Prop muted
Example
import {Image} from '@sessions/apps/preact';

<Image
  src="https://example.com/cover.jpg"
  alt="Album cover"
  width="600"
  height="600"
/>

In the same group