Skip to content

Rule.io SDK


Rule.io SDK / rcml/src / createSocialElement

Function: createSocialElement()

createSocialElement(options): RcmlSocial

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

Build an <rc-social> container — holds one or more <rc-social-element> children (each an icon link), laid out horizontally or vertically depending on attrs.mode.

Parameters

options

SocialElementOptions

options.children is the list of icon-link children (typically produced by createSocialChildElement); options.attrs controls layout / icon sizing / spacing.

Returns

RcmlSocial

A typed RcmlSocial node.

Throws

When attrs are invalid, or any child is not an <rc-social-element>.

Example

ts
createSocialElement({
  attrs: { mode: 'horizontal', align: 'center' },
  children: [
    createSocialChildElement({ attrs: { name: 'twitter', href: 'https://twitter.com/x' } }),
    createSocialChildElement({ attrs: { name: 'facebook', href: 'https://facebook.com/x' } }),
  ],
})