Skip to Content

Image props reference

Configure Rixl React image IDs, alt text, layout, loading callbacks, and analytics.

Use ImageProps from the package for the full TypeScript contract:

import type {ImageProps} from "@rixl/media-react/image";

export const imageProps = {
  id: "YOUR_IMAGE_ID",
  alt: "Mountain lake at sunrise",
  analytics: true,
} satisfies ImageProps;

Props

PropTypeDefaultPurpose
idstring—Rixl image ID to load through the SDK
altstringFile nameDescription of the rendered image
analyticsbooleantrueEnable image analytics
analyticsPage"standalone" | "feed" | "profile""standalone"View context
isCurrentbooleantrue when an ID is suppliedActive image state for analytics
feedId, postIdstring—Feed context
className, styleReact host attributes—Dimensions and layout
onLoadingChange(loading: boolean) => void—Loading state callback
onRixlAnalyticsCustom event callback—Analytics payload at event.detail.event

Published components resolve id through the SDK. Supplying imageData does not bypass that request in npm builds.

Layout

<Image id="YOUR_IMAGE_ID" alt="Mountain lake at sunrise" style={{display: "block", width: "100%", aspectRatio: "16 / 9"}} />

Give the host a height or aspect ratio. Internal image styles live in shadow DOM, so host classes do not set the inner image's object-fit or other styles. Use meaningful alt text; do not rely on a generated file name for an editorial image.

A ref receives the underlying RixlImage element.

On this page