For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Resources
Get started
ReferenceGuidesExamplesChangelog
ReferenceGuidesExamplesChangelog
  • Designer API
    • Introduction
    • Getting Started
    • Webflow CLI
    • Error Handling
    • App Modes
  • Elements
    • Creating & Retrieving Elements
    • Element Properties & Methods
    • Element Types & Methods
  • Styles
    • Managing Style Properties
    • Managing Variable Modes
  • Components
  • Variables & Collections
    • Variable Collections
    • Variables
        • Set variable value
        • Get variable value
        • Get variable name
        • Set variable name
        • Get variable binding
        • Get variable CSS name
        • Remove variable
    • Variable Modes
  • Assets
  • Pages & Folders
  • Utilities
    • User Events & Notifications
    • App Intents & Connections
  • Additional Resources
    • API Playground
    • FAQs
LogoLogo
Resources
Get started
On this page
  • variable.setName(name)
  • Syntax
  • Parameters
  • Returns
  • Example
  • Designer Ability
Variables & CollectionsVariablesManaging Variables

Set variable name

Was this page helpful?
Previous

Get variable binding

Next
Built with

variable.setName(name)

Sets the name of the variable.

Syntax

1variable.setName(name: string): Promise<null>;

Parameters

  • name : string - Name of the variable

Returns

Promise<null>

A Promise that resolves to null.

Example

1// Get Collection
2const collection = await webflow.getDefaultVariableCollection()
3
4// Get All Variables
5const variables = await collection.getAllVariables()
6
7// Get Value of first Variable
8const variable = variables[0]
9const value = await variable.setName("Primary")

Try this example

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canModifyVariablesAnyMainCanvasDesign