Element Types & Methods
Each element in Webflow has a specific type that determines its functionality and available methods. While all elements share some common properties, each element type also has specialized methods that allow you to manipulate that element’s unique characteristics.
Identifying element types
You can identify an element’s type using the element.type
property:
Element presets
To add a specific element type to the canvas, you can use the webflow.elementPresets
object, which contains a set of presets for different element types available in the designer.
Element type methods
Different element types have unique methods tailored to their functionality. Always check an element’s type before applying type-specific methods.
Customize HTML elements with methods for HTML tags and attributes.
Work with text content and manipulate their text values.
Manage images and alt text.
Modify heading levels and heading content.
Configure links with methods for URLs, targets, and link settings.
Create and configure forms and form field settings.
Get components definitions from a component instance.
Best Practices for Element Type Methods
-
Always check element type before applying type-specific methods:
-
Handle multiple element types with type guards:
-
Combine property and type checks for maximum safety: