Set display name (Beta)

element.setDisplayName(displayName)

Set the user-facing display name of an element shown in the Navigator panel. Setting the display name to an empty string resets the element to its default name.

Beta

These methods are in public beta and may change with future releases.

Syntax

1element.setDisplayName(displayName: string): Promise<null>

Parameters

  • displayName: string - The display name to set for the element. Pass an empty string to reset to the default name.

Returns

Promise<null>

A promise that resolves to null.

Example

1// Get the selected element
2const element = await webflow.getSelectedElement();
3
4if (element?.displayName) {
5
6 // Set a custom display name
7 await element.setDisplayName('Hero Wrapper');
8
9 // Reset to the default name
10 await element.setDisplayName('');
11}
12
13// Bulk rename child elements for clarity
14const root = await webflow.getRootElement();
15
16if (root) {
17 const children = await root.getChildren();
18 for (let i = 0; i < children.length; i++) {
19 if (children[i].displayName) {
20 await children[i].setDisplayName(`Section ${i + 1}`);
21 }
22 }
23}

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canDesignPrimaryMainCanvasDesign