Skip to content

Rule.io SDK


Rule.io SDK / rcml/src / createBodyElement

Function: createBodyElement()

createBodyElement(options): RcmlBody

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

Build an <rc-body> — the email content root inside the document. Its children are the top-level blocks the recipient sees: sections, loops, switches, wrappers.

Parameters

options

BodyElementOptions

options.children is the list of top-level blocks; options.attrs controls body-level background color and total width (defaults to 600px).

Returns

RcmlBody

A typed RcmlBody node.

Throws

When attrs are invalid or any child is not a valid body child.

Example

ts
createBodyElement({
  attrs: { 'background-color': '#ffffff', width: '600px' },
  children: [createSectionElement({ children: [...] })],
})