collection.createPercentageVariable(name, value)

Create a percentage variable with a name and value for the variable.

Syntax

1collection.createPercentageVariable(name: string, value: number | PercentageVariable): Promise<PercentageVariable>

Parameters

  • name : string - Name of the variable
  • value: number - Value of the variable.

Returns

Promise<PercentageVariable>

A Promise that resolves to a PercentageVariable object.

Example

1// Get Collection
2const collection = await webflow.getDefaultVariableCollection()
3
4// Create Percentage Variable of 50 Percent
5const myPercentageVariable = await collection?.createPercentageVariable("50%", 50)
6console.log(myPercentageVariable)

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canModifyVariablesAnyMainCanvasDesign