Skip to content

Rule.io SDK


Rule.io SDK / rcml/src / createButtonElement

Function: createButtonElement()

createButtonElement(options): RcmlButton

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

Build an <rc-button> element — a clickable button whose label is a ProseMirror content doc. The schema declares href but does not require it syntactically; pass it via attrs.href to produce a clickable button.

Parameters

options

ButtonElementOptions

Attribute map (including attrs.href for the link target)

  • content (RFM markdown string or pre-built content Json).

Returns

RcmlButton

A typed RcmlButton node.

Throws

When attrs are unknown / have invalid values, or content fails to parse / validate.

Example

ts
createButtonElement({
  attrs: { href: 'https://example.com', 'background-color': '#0066cc' },
  content: 'Shop now',
})