Get variable binding

variable.getBinding()

Returns a binding value for the variable. Use the binding value when creating or updating variables with custom values.

Syntax

variable.getBinding(): Promise<string>

Returns

Promise<string>

A Promise that resolves to a string representing the variable’s binding.

Example

// Create a variable
const webflowBlue = await collection?.createColorVariable(
"blue-500",
"#146EF5"
);
// Get the binding value for a variable
const binding = await webflowBlue.getBinding();
// binding = "var(--blue-500)"
// Use the binding value to create a variable with a custom value
const webflowBlue400 = await collection.createColorVariable("blue-400", {
type: "custom",
value: `color-mix(in srgb, ${binding}, white 50%)`,
});

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canReadVariablesAnyAnyAnyAny