Designer API
Control the Webflow Designer
asset.getName()
Retrieve name of specified asset.
1asset.getName(): Promise<string>
Promise<string>
A Promise that resolves to the name of the Asset
1// Get Selected Element2const el = await webflow.getSelectedElement()34// Check if element is selected and its type5if (!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 Asset13 const assetName = await asset?.getName() // Get Asset Name14 console.log(`Asset Name: ${assetName}`)15}
Try this example
Checks for authorization only