Skip to content

Rule.io SDK


Rule.io SDK / rcml/src / createLoopElement

Function: createLoopElement()

createLoopElement(options): RcmlLoop

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

Build an <rc-loop> — iterates its <rc-section> children once per entry in a data source (news feed, remote content, custom field, XML document). attrs.loop-type chooses the source family and attrs.loop-value identifies the specific source (e.g. the custom-field id or the remote URL).

Parameters

options

LoopElementOptions

options.attrs configures the iteration; options.children is the list of sections rendered per iteration.

Returns

RcmlLoop

A typed RcmlLoop node.

Throws

When attrs are invalid or any child is not an <rc-section>.

Example

ts
createLoopElement({
  attrs: { 'loop-type': 'custom-field', 'loop-value': '12345', 'loop-max-iterations': 5 },
  children: [createSectionElement({ children: [...] })],
})