Get component by name (Beta)

webflow.getComponentByName(name)

webflow.getComponentByName(group, name)

Retrieves a component based on its name and optionally its group.

Component names are case-sensitive.

Beta

This feature is released as part of a Beta program and may change in future releases.

Syntax

Get a component by its name:

1webflow.getComponentByName(name: string): Promise<Component>

Get a component by its name and group:

1webflow.getComponentByName(group: string, name: string): Promise<Component>

Returns

Promise<Component>

A Promise that resolves to a component.

Example

1// Fetch a component by name only
2const heroSection = await webflow.getComponentByName('Hero');
3console.log(heroSection.id);
4
5// Fetch a component scoped to a group
6const marketingHero = await webflow.getComponentByName('Marketing', 'Hero');
7console.log(marketingHero.id);

Designer Ability

Checks for authorization only

Designer AbilityPermissionLocaleBranchWorkflowSitemode
canAccessCanvasanyanyanyanyany