Check if a style is from a library

style.isFromLibrary()

Check if a style originated from a library, such as a Shared Library or AI Site Generation. This method is synchronous, so it doesn’t require await.

To read the origin as a value rather than a boolean, use the style.source property, which returns 'site' or 'library'.

Syntax

1style.isFromLibrary(): boolean

Returns

boolean

Returns true if the style originated from a library (Shared Library or AI Site Generation), and false otherwise.

Example

1// Get all styles and filter to site-only global classes
2const styles = await webflow.getAllStyles();
3const siteOnlyClasses = styles.filter(
4 (style) => style.getType() === "global" && !style.isFromLibrary()
5);

Designer ability

Designer AbilityLocaleBranchWorkflowSitemode
canAccessCanvasAnyAnyAnyAny