webflow.getStyleByName(name)

Retrieve a Style by its name.

Syntax

1webflow.getStyleByName(name: string): Promise<Style | null>

Parameters

  • name: string - The name of the style to retrieve.

Returns

Promise<Style | null>

A Promise that resolves to a style object, or null if the named style doesn’t exist.

Example

1getStyleByName: async (styleName: string) => {
2 // Retrieve the style by name
3 const retrievedStyle = await webflow.getStyleByName(styleName);
4
5 if (retrievedStyle) {
6 // Get and print properties of the retrieved style
7 const styleProperties = await retrievedStyle.getProperties();
8 console.log("Style properties:", styleProperties);
9 } else {
10 console.log(`Style ${styleName} not found.`);
11 }
12}

Designer Ability

Checks for authorization only

Designer AbilityLocaleBranchWorkflowSitemode
canAccessCanvasAnyAnyAnyAny