If you’re interested in keeping up with my writing, sign up for my newsletter!
The other week, I had some time to look into Figma Plugins during “Hack Days” at work. Since I’m familiar with both frontend and design, I thought it would be a good chance for me to take a step back from my day-to-day priorities and work on a hack days project that involves the two disciplines. I had a vague idea of creating a plugin that would help me with some of the grunt work that’s involved when I’m designing mockups.
The reason why I’m particularly excited about Figma is that it’s a design tool that’s built on web technologies. (It’s actually written in C++, but it’s compiled to WebAssembly and runs on modern browsers.) That means that I’m already familiar with the concepts and the tooling around building the plugins themselves. For example, I could use the built-in DevTools to explore and manipulate all the different objects on the page, using it as a sort of visual REPL for changing, say, the color of a rectangle on the page.
The Figma Plugin API is relatively new, and it has a couple of limitations at the moment. But at least it allows people to find things in the document, change their properties, create copies of them, and make them do internet stuff.
It was a bit overwhelming to learn how Figma Plugins work when I first started, so I figured that I start off by playing with basic shapes to keep things simple. It made learning more manageable compared to working on a component that’s filled with many different objects in it.
I found that text objects were reasonably easy to modify, so I figured that I could write a plugin that would translate the text in some of the mockups that I had. Translation plugins already exist in Figma (see both Translate and Translator), but I wanted to see if I could write something similar.
I had high expectations from myself at first: I wanted the plugin to actually work and translate any sort of text that I had. But I couldn’t get my plugin to do network requests to a translation service because I had trouble setting up packages from npm. I kept on getting errors from webpack that I didn’t understand so I gave up and went with mock requests for now. In hindsight, it might have been better if I didn’t rely on npm and made the requests myself using XMLHttpRequest or the Fetch API.
The translate plugin ended up working reasonably well otherwise. You were able to choose which language you’d like to translate your mockup into, and it doesn’t overwrite your original work.
The second plugin that I worked on populated the Yelp Review designs with new data. I found it tedious to copy-paste actual data online, so I thought I could solve that by letting the plugin do the hard work for me.
Unfortunately, just like the translation plugin, this plugin doesn’t actually make any network requests, and it only works on a specific component. So I think the next time I write a plugin, I’d like to create something that pulls in real data. I’d also like to figure out a way to generalize plugins that would work on any component that’s thrown at it—similar to how Microsoft’s Content Reel plugin works.
I’d definitely like to continue working on Figma Plugins in the future whenever I find some spare time. I’m impressed that they’re able to pull off a Google-docs-like design tool that’s cross-platform (you can design on a Chromebook if you wanted to), and that also has a well-thought-out plugin system. It’s an incredible tool, especially for remote workers like me, so I look forward to seeing Figma grow in the years to come.