render() and compose their outputs into the string your plugin returns to the FDO host.
All DOM classes extend the base DOM class, which gives every helper a common set of capabilities: CSS-in-JS styling via goober, extra CSS classes, inline style objects, custom HTML attributes, event handlers, and accessibility attributes.
DOM helpers run in the plugin backend runtime (inside
render()). They produce HTML strings consumed by the FDO iframe host pipeline. Do not call DOM helpers from inside <script> blocks or renderOnLoad() — those run in the iframe.Common options
Every DOM helper method accepts anoptions parameter typed as Partial<typeof DOM.DEFAULT_OPTIONS>:
id?: string— sets the element’sidattribute. If omitted, the SDK generates a random one.otherProps?: Record<string, any>— additional HTML attributes (scope,colspan,width,loading, etc.).customAttributes?: Record<string, string>— on methods that take extended options, merges arbitrary HTML attributes directly onto the element.
CSS-in-JS with goober
The baseDOM class wraps goober for CSS-in-JS. Goober is injected into the iframe runtime as window.goober, but you interact with it through the helper methods on any DOM instance:
classes option of any element. The generated <style> block is extracted and prepended automatically when you call renderHTML().
DOMText
DOMText creates text-level and block-level text elements.
| Method | Element | Notes |
|---|---|---|
createHText(level, content, options?, id?) | h1–h6 | level must be 1–6 or throws |
createPText(content, options?, id?) | p | |
createSpanText(content, options?, id?) | span | |
createText(content, options?, id?) | span | alias for createSpanText |
createDivText(content, options?, id?) | div | |
createStrongText(content, options?, id?) | strong | |
createEmText(content, options?, id?) | em | |
createBText(content, options?, id?) | b | |
createIText(content, options?, id?) | i | |
createCodeText(content, options?, id?) | code | |
createPreText(content, options?, id?) | pre | |
createBlockQuoteText(content, options?, id?) | blockquote | |
createMarkText(content, options?, id?) | mark | |
createSmallText(content, options?, id?) | small | |
createKbdText(content, options?, id?) | kbd | |
createUText(content, options?, id?) | u | |
createSText(content, options?, id?) | s | |
createInsText(content, options?, id?) | ins | |
createCiteText(content, options?, id?) | cite | |
createAbbrText(content, title, options?, id?) | abbr | adds title attribute |
createLabelText(content, htmlFor, options?, id?) | label | adds htmlFor attribute |
DOMText methods is HTML-escaped automatically, so user-supplied strings are safe to pass directly.
DOMButton
DOMButton creates <button> elements with attached event handlers.
pure-button (from the injected PureCSS library), giving you zero-config button styling.
Event handler functions are serialized to strings for the iframe context. Keep handlers simple — they cannot close over backend-runtime variables.
DOMLink
DOMLink creates <a> anchor elements. Unlike most helpers, you pass options at construction time.
DOMTable
DOMTable creates full table structures — <table>, <thead>, <tbody>, <tfoot>, <tr>, <th>, <td>, and <caption>.
otherProps to createTableHeader or createTableCell for attributes like scope, colspan, and rowspan:
DOMInput
DOMInput creates form controls: <input>, <textarea>, <select>, <option>, and <optgroup>. Options and props are passed at construction.
createOptgroup:
DOMMedia
DOMMedia creates self-closing <img> elements with built-in accessibility support.
alt value. Pass width, height, and loading through otherProps:
DOMSemantic
DOMSemantic creates HTML5 semantic container elements: <article>, <section>, <nav>, <header>, <footer>, <aside>, and <main>.
DOMNested
DOMNested creates container and list elements: <div>, <ul>, <ol>, <li>, <dl>, <dt>, <dd>, <form>, <fieldset>, and <legend>.
Block containers and forms
Lists
Definition lists
DOMMisc
DOMMisc provides miscellaneous elements. Currently it exposes a divider() method that renders a styled <hr>.
#cccccd) with 10px margin. Override with options.style:
Full composition example
The following is taken fromexamples/05-advanced-dom-plugin.ts and shows how the helper classes work together in a complete render() method: