Skip to main content
Question

How to Dynamically Convert HTML to Figma Nodes Without Hardcoding?

  • November 20, 2024
  • 0 replies
  • 54 views

Malhar_Trivedi

Hello Figma Community,

I’m developing a Figma plugin where the UI sends arbitrary HTML content to the plugin’s main code using parent.postMessage. The main code is then responsible for dynamically converting the HTML structure into Figma nodes on the canvas.

Goals:

  1. Parse any valid HTML provided by the user (e.g., <div><strong>Hello World</strong></div>).
  2. Dynamically generate equivalent Figma nodes (like Frame, Text, Group, etc.) that mirror the HTML structure and styles.
  3. Avoid hardcoding specific tag types (e.g., <div> or <span>) so that the plugin works with any HTML.

Questions for the Community:

  1. Are there best practices or libraries for dynamically converting HTML to Figma nodes?
  2. How can I efficiently handle styles and attributes (e.g., inline style or class) from HTML in Figma?
  3. Are there any limitations or pitfalls I should be aware of when replicating HTML structures in Figma?
This topic has been closed for replies.

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings