Skip to main content

I am creating a figma plugin and I cannot add an svg image to the ui.html, please help

How do you add SVG to HTML?


  <img src="search.svg" alt="" width="120">

Please note that the SVG and ui.html are in the same directory


figma.com

This worked, thanks for the help


I have another problem though,


I used figma.ui.postMessage('msg') in my code.ts file to send a message to the ui, then I listen to the message in ui.html using onmessage = (event) => { console.log("got this from the plugin code", event.data.pluginMessage) } but I do not get any response in my ui.html


Iโ€™m not sure why this happened, because the code is correct.

So you donโ€™t see the line got this from the plugin code msg in the console?


After I debugged for a while, I found out onmessage = (event) => { console.log("got this from the plugin code", event.data.pluginMessage) } should come immediately after opening the ui.html <script> tag.

I think my issues have been resolved successfully.


Thanks for you help