Remove style properties

style.removeProperties(props, options?)

Remove multiple style properties from a Style object.

Syntax

1style.removeProperties(
2 props: Array<{{STYLE_PROPERTY}}>,
3 options?: {
4 breakpoint?: {{BREAKPOINT_ID}},
5 pseudo?: {{PSEUDO_STATE_KEY}},
6 variantId?: {{VARIANT_ID}}
7 }
8): Promise<void>

Parameters

  • props: Array<StyleProperty> - The properties to remove from the style. See the Style Properties reference for a list of supported properties.

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

    • breakpoint: BreakpointId - Identifies the responsive breakpoint to remove the properties from.

      1type BreakpointId = "xxl" | "xl" | "large" | "main" | "medium" | "small" | "tiny"
    • pseudo: PseudoStateKey - Specifies a CSS pseudo-class to remove the properties from.

      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<null>

A Promise that resolves to null

Example

1// Get Selected Element
2const selectedElement = await webflow.getSelectedElement()
3
4if (selectedElement?.styles) {
5
6 // Get Element Styles
7 const styles = await selectedElement.getStyles()
8 const primaryStyle = styles[0]
9 const properties : StyleProperty[] = ['background-color', 'accent-color',"font-family"]
10 await primaryStyle.removeProperties(properties)
11
12}

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canModifyStyleBlocksAnyAnyCanvasDesign