style.setProperties(props, options?)

Set multiple style-properties on a Style object.

Syntax

1 style.setProperties( props: PropertyMap, options?: BreakpointAndPseudo): Promise<void>

Parameters

  • props : PropertyMap - An object of style properties and their corresponding values to set. See the style properties list for an index of CSS properties and their accepted value types.
  • options : BreakpointAndPseudo {breakpoint: BreakpointId, pseudo: PseudoStateKey?}- An optional parameter to filter properties based on a breakpoint and/or pseudo-class, also known as a pseudo-state.

    • BreakpointId: "xxl" | "xl" | "large" | "main" | "medium" | "small" | "tiny" - An optional identifier of the breakpoint size, also known as media query, in the Designer.
    • PseudoStateKey: "noPseudo" | "nth-child(odd)" | "nth-child(even)" | "first-child" | "last-child" | "hover" | "active" | "pressed" | "visited" | "focus" | "focus-visible" | "focus-within" | "placeholder" | "empty" | "before" | "after" - An optional identifier for the pseudo-classes of an element that can be targeted and styled using CSS.

Returns

Promise<null>

A Promise that resolves to null

Example

1// Create a new style
2const newStyle = await webflow.createStyle('MyCustomStyle')
3
4cosnt propertyMap : PropertyMap = {
5 'background-color': "blue",
6 'font-size': "16px",
7 'font-weight': "bold",
8 }
9const myBreakpoint = {breakpoint: "medium"} as BreakpointAndPseudo
10
11// Set and save properties for the style
12await newStyle.setProperties(propertyMap, myBreakpoint);
13await newStyle.save()

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canModifyStyleBlocksAnyAnyCanvasDesign