asset.getName()

Retrieve name of specified asset.

Syntax

1asset.getName(): Promise<string>

Returns

Promise<string>

A Promise that resolves to the name of the Asset

Example

1// Get Selected Element
2const el = await webflow.getSelectedElement()
3
4// Check if element is selected and its type
5if (!el || el.type !== 'Image') {
6 console.error('Please select an Image element on the canvas')
7 await webflow.notify({
8 type: 'Error',
9 message: 'Please select an Image element on the canvas',
10 })
11} else {
12 const asset = await el.getAsset() // Get Asset
13 const assetName = await asset?.getName() // Get Asset Name
14 console.log(`Asset Name: ${assetName}`)
15}

Designer Ability

Checks for authorization only

Designer AbilityLocaleBranchWorkflowSitemode
canAccessAssetsanyanyanyany