Figma Support Forum

Passing Code.JS or Code.TS values/variables to UI.HTML

Hello! I’m currently working on a plugin and I’m trying to pass the Font Size value to display within my Plugin UI. I’m retrieving the value via const selection = figma.currentPage.selection["0"].fontSize; but I can’t seem to get it to display within my plugin UI. I’ve tried document.getElementById('font_field').innerText = (figma.currentPage.selection["0"].fontSize); but no luck.

My main goal is to actually just pass the value to a tensor flow script that’s working within my html doc but to also display it within the UI.

How do I communicate between the two files? : )

Thank you!!

You must send the message using postMessage.

Worked like a charm, thank you!