For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Resources
Get started
ReferenceGuidesExamplesChangelog
ReferenceGuidesExamplesChangelog
  • Designer API
    • Introduction
    • Getting Started
    • Webflow CLI
    • Error Handling
    • App Modes
  • Elements
    • Creating & Retrieving Elements
    • Element Properties & Methods
    • Element Types & Methods
  • Styles
      • Get all styles
      • Get style by name or path
      • Create style
      • Set style name
      • Remove style
      • Is combo class
      • Get style type
      • Is from library
      • Get parent style
    • Managing Style Properties
    • Managing Variable Modes
  • Components
  • Variables & Collections
    • Variable Collections
    • Variables
    • Variable Modes
  • Assets
  • Pages & Folders
  • Utilities
    • User Events & Notifications
    • App Intents & Connections
  • Additional Resources
    • API Playground
    • FAQs
LogoLogo
Resources
Get started
On this page
  • webflow.getStyleByName(nameOrPath)
  • Syntax
  • Parameters
  • Returns
  • Examples
  • Designer Ability
StylesCreating & Retrieving Styles

Get style by name or path

Was this page helpful?
Previous

Create style

Next
Built with

webflow.getStyleByName(nameOrPath)

Retrieve a Style by its name or path.

Syntax

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

Parameters

  • nameOrPath: string | Array<string> - The name of the style to retrieve or the path to the style to retrieve, consisting of the name of the parent and the name of the style.

Returns

Promise<Style | null>

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

Examples

Getting a style by name:

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

Try this example

Getting a style by path:

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

Try this example

Designer Ability

Checks for authorization only

Designer AbilityLocaleBranchWorkflowSitemode
canAccessCanvasAnyAnyAnyAny