APIsChangelog
Log In

Get component

ComponentElement.getComponent()

Get the Component Definition that is associated to a Component Instance

Syntax

element.getComponent(): Promise<Component>

Returns

Promise<Component>

A promise that resolves to a Component Object associated with a Component Instance.

//Get User Selected Element from the Designer
const parent = await webflow.getSelectedElement();

// Check if this selected element is a Component Instance
if(parent && !parent.configurable && parent.type === 'ComponentInstance'){
      console.log(await parent.getComponent().getName());
    }