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
| Prop | Type | Default | Purpose |
|---|---|---|---|
id | string | — | Rixl image ID to load through the SDK |
alt | string | File name | Description of the rendered image |
analytics | boolean | true | Enable image analytics |
analyticsPage | "standalone" | "feed" | "profile" | "standalone" | View context |
isCurrent | boolean | true when an ID is supplied | Active image state for analytics |
feedId, postId | string | — | Feed context |
className, style | React host attributes | — | Dimensions and layout |
onLoadingChange | (loading: boolean) => void | — | Loading state callback |
onRixlAnalytics | Custom 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.