DOMButton generates <button> elements as HTML strings. It applies the pure-button Blueprint class by default, and lets you attach a click handler that runs inside the plugin iframe runtime.
Import
Constructor
DOMButton extends DOM and inherits the full styling and attribute utilities.
Methods
createButton
Creates a <button> element with a label, click handler, and optional style overrides.
The visible text content of the button.
A function serialized and attached as the
onClick event handler. The function runs in the plugin iframe context — you have access to document, window, and any globals available there.Style options. Supports
classes, style, and disableDefaultClass.classes— additional CSS class namesstyle— inline style object compiled to a goober atomic classdisableDefaultClass— set totrueto remove the built-inpure-buttonclass
Element
id. Auto-generated if omitted.Any additional HTML attributes to merge into the element, such as
disabled, type, or aria-label.string — the rendered <button> HTML.
Examples
Basic button
Styled button
Button with DOM interaction in the click handler
The click handler is serialized as a function and runs inside the plugin iframe. You can safely referencedocument and window from within it.
Disabled button
Passdisabled: true via otherProps:
Stripping the default Blueprint class
SetdisableDefaultClass: true to remove the pure-button class and apply only your own styles:
Full composition example
Click handlers are serialized via
Function.prototype.toString(). Closures that capture variables from an outer plugin scope will not work as expected — write self-contained handlers that read state from the DOM directly.