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
    • Managing Style Properties
      • Get style properties
      • Set style properties
      • Get style property
      • Set style property
      • Remove a style property
      • Remove style properties
      • Remove all 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.getProperties(options?)
  • Syntax
  • Parameters
  • Returns
  • Example
  • Designer ability
StylesManaging Style Properties

Get style properties

Was this page helpful?
Previous

Set style properties

Next
Built with

style.getProperties(options?)

Retrieves the CSS properties of the specified Style Object. Additionally, you can get properties on a style for a specific breakpoint or pseudo-state.

See the style properties list for an index of CSS properties to set on a style.

Syntax

1style.getProperties(
2 options?: {
3 breakpoint?: {{BREAKPOINT_ID}},
4 pseudo?: {{PSEUDO_STATE_KEY}},
5 variantId?: {{VARIANT_ID}}
6 }
7): Promise<{{PROPERTY_MAP}}>

Parameters

  • options: StyleOptions - An object that filters properties by breakpoint, pseudo-state, and/or variant. (Optional)

    • breakpoint: BreakpointId - Identifies the responsive breakpoint to get styles for.

      1type BreakpointId = "xxl" | "xl" | "large" | "main" | "medium" | "small" | "tiny"
    • pseudo: PseudoStateKey - Specifies a CSS pseudo-class to get styles for.

      1type PseudoStateKey = "noPseudo" | "nth-child(odd)" | "nth-child(even)" |
      2 "first-child" | "last-child" | "hover" | "active" |
      3 "visited" | "focus" | "focus-visible" | "focus-within" |
      4 "placeholder" | "empty" | "before" | "after"
    • variantId: string - The ID of the variant to target. 'base' is not a valid value. (Optional)

Returns

Promise<PropertyMap>

A Promise that resolves to a PropertyMap object. A dictionary of style properties and their values.

Example

1// Get selected element
2const element = await webflow.getSelectedElement()
3
4if (element?.styles) {
5
6 // Get Element Styles
7 const styles = await element.getStyles()
8
9 // Initialize an empty object to store all properties
10 const allProperties: { [key: string]: any } = {};
11
12 for (let style of styles) {
13 // Use string type for styleName
14 const styleName: string = await style.getName();
15 const options: StyleOptions = { breakpoint: 'xxl' }
16 const properties = await style.getProperties(options);
17 allProperties[styleName] = properties;
18 }
19
20 console.log(allProperties);
21
22}

Try this example

Designer ability

Checks for authorization only

Designer AbilityLocaleBranchWorkflowSitemode
canAccessCanvasAnyAnyAnyAny