Skip to content

Rule.io SDK


Rule.io SDK / rcml/src / createFontElement

Function: createFontElement()

createFontElement(options): RcmlFont

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

Build an <rc-font> — a web-font declaration pointing at a CSS stylesheet that imports the font. Sits inside <rc-head> and exposes the font family for use in other head / body attrs.

Parameters

options

FontElementOptions

options.attrs.name is the font family identifier; options.attrs.href is the CSS URL.

Returns

RcmlFont

A typed RcmlFont node.

Throws

When attrs.name / attrs.href are missing or invalid.

Example

ts
createFontElement({
  attrs: { name: 'Inter', href: 'https://fonts.example.com/inter.css' },
})