APIsChangelog
Log In

Get component name

component.getName()

Get the name of the Component Object.

Syntax

component.getName(): Promise<string>

Returns

Promise<string>

A Promise that resolves to a string representing the name of a component.

const myComponentName = "Hero-Component";
const components = await webflow.getAllComponents();

// Check if component exists
for (const c in components) {
  const currentComponentName = await components[c].getName();
  if (myComponentName === currentComponentName) {
    console.log("Found Hero Component");
  }
}