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
  • style.getType()
StylesCreating & Retrieving Styles

Get a style's type

Was this page helpful?
Previous

Check if a style is from a library

Next
Built with

style.getType()

Retrieve a style’s type, as it appears in the Designer’s Styles panel. This method is synchronous, so it doesn’t require await.

Syntax

1style.getType(): StyleType

Returns

StyleType

A string describing the style’s type. Returns one of the following values:

ValueDescription
'global'A named, reusable class style with no combinator.
'combo'A class modifier applied on a base class, such as .button.is-primary.
'tag'A style that targets an HTML tag, such as h1 or body.
'element'A style scoped to a single element instance.
'descendant'A class style nested under another class, such as .parent .child.

'element' styles can appear in webflow.getAllStyles() results, but most style operations on them aren’t supported and reject with a resourceMissing error.

Example

1// Get all styles and filter to global classes
2const styles = await webflow.getAllStyles();
3const globalClasses = styles.filter((style) => style.getType() === "global");

Try this example

Designer ability

Designer AbilityLocaleBranchWorkflowSitemode
canAccessCanvasAnyAnyAnyAny