Skip to content

Rule.io SDK


Rule.io SDK / rcml/src / createImageElement

Function: createImageElement()

createImageElement(options): RcmlImage

Defined in: rcml/src/email/create-rcml-element.ts:421

Build an <rc-image> element — a responsive image in the email body. attrs.src is expected (the schema validates URL format when provided); an image without src renders nothing in the Rule.io editor.

Parameters

options

ImageElementOptions

Attribute map. attrs.src is the image URL; other attrs control alignment, sizing, padding, optional link target (href), etc.

Returns

RcmlImage

A typed RcmlImage node.

Throws

When attrs are unknown or have invalid values.

Example

ts
createImageElement({
  attrs: {
    src: 'https://cdn.example.com/hero.png',
    alt: 'Summer sale banner',
    width: '600px',
  },
})