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
    • Variable Modes
  • Assets
      • Get Asset Name
      • Set Asset Name
      • Get Alt Text
      • Set Alt Text
      • Set Asset File
      • Get Asset MIME Type
      • Get Asset URL
      • Get folder of Asset
      • Set folder for Asset
  • Pages & Folders
  • Utilities
    • User Events & Notifications
    • App Intents & Connections
  • Additional Resources
    • API Playground
    • FAQs
LogoLogo
Resources
Get started
On this page
  • asset.setAltText(altText, localeId?)
  • Syntax
  • Parameters
  • Returns
  • Example
  • Designer ability
AssetsManaging Assets

Set Alt Text

Was this page helpful?
Previous

Set Asset File

Next
Built with

asset.setAltText(altText, localeId?)

This method sets the Alt Text for a specific Asset.

Syntax

1asset.setAltText(altText: string | null; localeId?: string): Promise<null>

Parameters

  • altText: string - The alt text for the Asset. If null is passed as this parameter, Webflow will set the asset alt text to “decorative.”
  • localeId string (optional) - The Locale ID for the Alt Text.

Returns

Promise<null>

A Promise that resolves to null.

Example

1// Get Asset by ID
2const asset = await webflow.getAssetById(assetId)
3console.log(asset)
4
5if (asset) {
6 // Get asset URL
7 const originalAltText = await asset.getAltText()
8 await asset.setAltText(altText)
9 const newAltText = await asset.getAltText()
10 console.log(`Original Asset Alt Text: ${originalAltText}`)
11 console.log(`New Asset Alt Text: ${newAltText}`)
12}

Try this example

Designer ability

Checks for authorization only

Designer AbilityLocaleBranchWorkflowSitemode
canManageAssetsanyanyanyany