webflow.elementBuilder(preset)Construct complex element structures before adding them to a page. This method is optimized for bulk creation of elements, and is particularly useful when working with SVG graphics or nested element groups like a navigation menu. This approach is more efficient than creating and adding elements one at a time, especially for complex designs.
Currently, only DOM elements can be created with the element builder.
BuilderElement
A builder element object designed for creating and manipulating hierarchical structures. This object has these methods:
append(): Add a child element to this builder elementsetTag(): Set the HTML tag for this DOM elementsetAttribute(): Set an attribute on this DOM elementsetTextContent(): Set the text within this DOM elementsetStyles(): Set styles on this DOM elementGet the parent element
Use webflow.getSelectedElement() to select the parent element. This is where your new structure will be added.
Create a builder element
Use webflow.elementBuilder(webflow.elementPresets.DOM) to create a builder element.
Configure the builder element
Use the builder element to configure the tags, attributes, and styles of the new structure.
The element builder is particularly useful for:
Promise.all for batch operations when modifying multiple elements