Appearance
Rule.io SDK / rcml/src / email
Variable: email
constemail:object
Defined in: rcml/src/email/email-namespace.ts:39
Namespace object grouping the Email RFM string builders.
Each builder returns a literal Email RFM directive string suitable for splicing into copy that is later compiled and parsed.
Type Declaration
createCustomField
createCustomField: (
opts) =>string
Build a ::placeholder{type="CustomField" …} directive string.
The atom's name= attribute is group.name joined with a dot; the original= attribute follows the canonical [CustomField:<id>] form.
Parameters
opts
group
string
id
number
name
string
Returns
string
createFont
createFont: (
opts) =>string
Build a :font[content]{…} inline directive string.
Style options map to their kebab-cased Email RFM attribute names (fontSize → font-size, textDecoration → text-decoration, etc.). content may itself be another atom string for nested composition.
Parameters
opts
color?
string
content
string
fontFamily?
string
fontSize?
string
fontStyle?
string
fontWeight?
string
letterSpacing?
string
lineHeight?
string
textDecoration?
string
textTransform?
string
Returns
string
createLink
createLink: (
opts) =>string
Build a :link[label]{…} inline directive string.
label may itself be another atom string (e.g. the output of createFont) to support nested composition like font-inside-link.
Parameters
opts
href
string
label
string
noTracked?
boolean
target?
string
Returns
string
createLoopValue
createLoopValue: (
opts) =>string
Build a ::loop-value{…} directive string.
original= follows the canonical [LoopValue:<key>] form. index= defaults to key when omitted — matches every existing usage.
Parameters
opts
index?
string
key
string
Returns
string
Example
ts
import { email } from '@rule/rcml';
const fieldAtom = email.createCustomField({
group: 'Order', name: 'Total', id: 13,
});
const linkAtom = email.createLink({
label: 'Click here',
href: 'https://example.com',
});