Remove variable modes

style.removeVariableModes(props, options)

Remove multiple variable modes from a style. Each variable mode is associated with a variable collection. To remove multiple variable modes, provide an array of variable mode objects.


Syntax

1style.removeVariableModes(
2 modes: Array<{{VARIABLE_MODES}}>,
3 options?: {
4 breakpointId?: {{BREAKPOINT_ID}},
5 pseudoStateKey?: {{PSEUDO_STATE_KEY}}
6 }
7): Promise<null>;

Parameters

  • modes: Array<VariableMode> - An array of variable modes to remove.

  • options?: BreakpointAndPseudo - An object t hat lets you filter properties by breakpoint and/or pseudo-state. (Optional)

    • 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// Get Styles
6const styles = await selectedElement.getStyles()
7const primaryStyle = styles[0] // Get the primary style
8
9// Get Variable Modes from Collection
10const variableModes = await variableCollection?.getAllVariableModes()
11const remove = await primaryStyle?.removeVariableModes(variableModes)
12
13}

Designer ability

Designer AbilityLocaleBranchWorkflowSitemode
canModifyStyleBlocksAnyAnyCanvasDesign