APIsChangelog
Log In

Get root element

component.getRootElement()

Retrieves the root element of the component.

Syntax

webflow. getRootElement(): Promise<null | AnyElement>;

Returns

Promise< AnyElement>

A Promise that resolves to the root element.

Example

// Get Component
const all = await webflow.getAllComponents()
const firstComponent = all[0]

// Get Root Element of Component
const root = await firstComponent?.getRootElement()
console.log(root)