style.setProperties(props, options?)

Set multiple style-properties on a Style object.

Syntax

1 style.setProperties( props: PropertyMap, 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// 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
Built with