Get variable mode by ID

collection.getVariableModeById(string: modeId)

Get a variable mode by its ID.

Syntax

1collection.getVariableModeById(modeId: string): Promise<VariableMode>

Parameters

  • modeId: string - The ID of the variable mode to get. Pass the reserved ID "base" to get the collection’s base mode.

Returns

Promise<VariableMode> A Promise that resolves to a variable mode object.

Example

1// Get Collection
2const collection = await webflow.getDefaultVariableCollection()
3
4// Get Variable Mode by ID
5const variableMode = await collection?.getVariableModeById(modeId)
6console.log(variableMode)

"base" is a reserved mode ID. Passing it returns the collection’s base mode — the default mode every variable falls back to. The base mode’s ID stays "base" even when its display name is customized, so this is a reliable way to fetch it without first looking it up by name.

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canReadVariablesAnyAnyAnyAny