Skip to content

Rule.io SDK


Rule.io SDK / rcml/src / createClassElement

Function: createClassElement()

createClassElement(options): RcmlClass

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

Build an <rc-class> — a named group of attributes that body elements reference via their own rc-class attribute. Lets you centralise typography (h1/h2/paragraph) and button style in one place.

Parameters

options

ClassElementOptions

options.attrs.name is the class identifier; other attrs (color, font-family, font-size, …) are the style payload.

Returns

RcmlClass

A typed RcmlClass node.

Throws

When attrs are unknown or have invalid values.

Example

ts
createClassElement({
  attrs: { name: 'rcml-h1-style', color: '#1a1a1a', 'font-size': '28px', 'font-weight': '700' },
})