Get a style's type

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.

You can also read a style’s type from the style.type property, which returns the same value.

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");

Designer ability

Designer AbilityLocaleBranchWorkflowSitemode
canAccessCanvasAnyAnyAnyAny