Designer API
Control the Webflow Designer
element.getStyles()
Retrieve the current style properties of the element for analysis or changes.
1element.getStyles(): Promise<Array<Style>>
Promise<Style>
A Promise that resolves to an array of Style Objects.
1// Get Selected Element2const selectedElement = await Webflow.getSelectedElement()34if (selectedElement?.styles) {56 // Get Styles7 const styles = await selectedElement.getStyles()89 // Get Style Details10 const styleDetails = styles.map(async style => {1112 const styleName = await style.getName()13 const styleProperties = await style.getProperties()1415 return {16 Name: styleName,17 Properties: styleProperties,18 ID: style.id,19 }2021 })2223 // Print Style Details24 console.log(await Promise.all(styleDetails))25}
Checks for authorization only