APIsChangelog
Log In

Get variable by name

collection.getVariableByName(name)

Retrieve a variable by its name.

Syntax

collection.getVariableByName(name: string): Promise<null | Variable>>

Parameters

  • name : string - Name of the variable you'd like to retrieve

Returns

Promise< Variable | null>

A Promise that resolves to a Variable object, or null if not found

Example

// Get Collection
const collection = await webflow.getDefaultVariableCollection()

// Get Variable by Name
const variableByName = await collection?.getVariableByName('Space Cadet')
console.log(variableByName)