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
      • Attributes
      • Custom Attributes
      • Styles
        • Get Styles
        • Set Styles
      • Text Content
      • Display Name
    • Element Types & Methods
  • Styles
    • 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
  • element.getStyles()
  • Syntax
  • Returns
  • Example
  • Designer Ability
ElementsElement Properties & MethodsStyles

Get Styles

Was this page helpful?
Previous

Set Styles

Next
Built with

element.getStyles()

Retrieve the current style properties of the element for analysis or changes.

Syntax

1element.getStyles(): Promise<Array<Style>>

Returns

Promise<Style>

A Promise that resolves to an array of Style Objects.

Example

1// Get Selected Element
2const selectedElement = await Webflow.getSelectedElement()
3
4if (selectedElement?.styles) {
5
6 // Get Styles
7 const styles = await selectedElement.getStyles()
8
9 // Get Style Details
10 const styleDetails = styles.map(async style => {
11
12 const styleName = await style.getName()
13 const styleProperties = await style.getProperties()
14
15 return {
16 Name: styleName,
17 Properties: styleProperties,
18 ID: style.id,
19 }
20
21 })
22
23 // Print Style Details
24 console.log(await Promise.all(styleDetails))
25}

Designer Ability

Checks for authorization only

Designer AbilityLocaleBranchWorkflowSitemode
canAccessCanvasAnyAnyAnyAny