Remove style properties

style.removeProperties(prop, options?)

Remove multiple style properties from a Style object.

Syntax

1style.remove(props: Array<StyleProperty>,options?: BreakpointAndPseudo): Promise<void>

Parameters

  • options: BreakpointAndPseudo (optional)

    An object that lets you filter properties by breakpoint and/or pseudo-state.

    1{
    2 breakpoint?: BreakpointId
    3 pseudo?: PseudoStateKey
    4}
    • BreakpointId: Identifies the responsive breakpoint to get styles for.

      1type BreakpointId = "xxl" | "xl" | "large" | "main" | "medium" | "small" | "tiny"
    • 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" | "pressed" |
      3 "visited" | "focus" | "focus-visible" | "focus-within" |
      4 "placeholder" | "empty" | "before" | "after"

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
Built with