Get component name

component.getName()

Get the name of the Component Object.

To get the name along with other settings, see Get component settings.

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");
}
}

Designer Ability

Checks for authorization only

Designer AbilityLocaleBranchWorkflowSitemode
canAccessCanvasanyanyanyany