APIsChangelog
Log In
APIs

Get style by name

webflow.getStyleByName(name)

Retrieve a Style by its name.

Syntax

webflow.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

getStyleByName: async (styleName: string) => {
  // Retrieve the style by name
  const retrievedStyle = await webflow.getStyleByName(styleName);

  if (retrievedStyle) {
    // Get and print properties of the retrieved style
    const styleProperties = await retrievedStyle.getProperties();
    console.log("Style properties:", styleProperties);
  } else {
    console.log(`Style ${styleName} not found.`);
  }
}

Designer Ability

Checks for authorization only

Designer AbilityLocaleBranchWorkflowSitemode
canAccessCanvasAnyAnyAnyAny