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.getCSSName()
  • Syntax
  • Returns
  • Example
  • Designer ability
Variables & CollectionsVariablesManaging Variables

Get CSS name

Was this page helpful?
Previous

Remove variable

Next
Built with

variable.getCSSName()

Returns the custom property name of a variable (e.g., --primary).

This is distinct from variable.getBinding(), which returns the variable wrapped in a var() function (e.g., var(--primary)). Use getCSSName() when you need a reference to the variable’s name, for example, to override its value in a custom stylesheet.

Syntax

1variable.getCSSName(): Promise<string>

Returns

Promise<string>

A Promise that resolves to the variable’s CSS name.

Example

1// Create a variable
2const webflowBlue = await collection?.createColorVariable(
3 "blue-500",
4 "#146EF5"
5);
6
7// Get the CSS name for the variable
8const cssName = await webflowBlue.getCSSName();
9// cssName = "--blue-500"

Designer ability

Designer AbilityLocaleBranchWorkflowSitemode
canReadVariablesAnyAnyAnyAny