element.prepend(newElement, settings?)Insert a new element onto the page as the first child of the target element.
newElement: webflow.elementPresets.<preset> | Component | string - The new element to be inserted into the hierarchy:
webflow.elementPresets object, which contains all Webflow elements that can be inserted onto the canvasimg, h2, or sectionIf you pass a string value, the API converts it to an element preset. This table maps these values to element presets:
element.setSettings(). Pass an object with one or more setting keys and their values. If omitted, element settings use their defaults.Settings are pre-validated against the target element type before the element is created.
If a setting key is not applicable to the target element type (for example, passing assetId on a div), the element is not created and an error is thrown.
Component instances do not accept settings at insertion time; use setProps() after creation instead.
Promise<AnyElement>
A Promise that resolves to an AnyElement object.
AnyElement represents the various element types available in a Webflow project. See a full list of supported element types in our Designer Extension type definitions.
Insert an element without providing settings:
Insert an element with settings: