Skip to main content

How do I import CSS to my UI.HTML file? I’ve been trying forever but unfortunately with no luck.


ui.css is linked in my project folder, not under any folders.


Here’s what I currently have in my ui.html file:



<link rel="stylesheet" href="ui.css">

Any help is appreciated. Thank you so much!! <3


When I try the same code in the browser, it links and the elements change but, when I open my Figma Plugin’s UI window, there’s no luck.

The plugin only loads what’s listed in the manifest.json, ignoring all other files. Since it only allows you to specify HTML for UI and JS for backend, you have three options here:




  1. Write CSS and JS inside of the HTML file so you don’t have to load them from other files.




  2. Host and load CSS and JS from the web. Not every hosting would work due to CORS and the plugin having origin set to null. This isn’t a very common way I think.




  3. Use a bundler to inline all files you want into HTML. This is good for larger plugins where writing CSS and JS directly inside of the HTML file would be difficult. You can use Rollup, Webpack, esbuild and anything else you like.




Worked like a charm! Thanks so much. Have an excellent weekend!


@D_S Can you share your solution, please? Having the same issue here…


did you find the solution? extrnal css is not working at all. No imports no npm package is working


In the manifest there is a “allowedDomains” portion. If you add the cdn link to css sheet you can use external css in the plugins.


Does it work for you guys? I tried to put the CSS code inside the HTML file as inline CSS, but only tag-targeting stylings work (e.g. a, html, body, etc.). All class-based stylings (e.g. .text-center, .justify-start, etc.) are not working at all.


This worked for me. I’m using parcel as my bundler.


<style>@import "./ui.css";</style>


And this for the JS:


<script type="module"> import "./ui.js"; </script>


Reply