Create scalable Figma plugins with ease, using the power of Svelte + Vite!
This is a boilerplate for building Figma plugins with Svelte, Vite, and TypeScript. To learn more about building plugins, see the Figma Plugin API documentation
Based on the great work of figma-plugin-react-vite
Tabular: Use as many tabs as needed to create a multi-tabbed UI. Create a new entry in src/ui/furniture/tabs/
with an associated name
and icon
in the module context. It will be automatically added to the UI's nav bar.
Common Code: Figma plugins with an interface are rendered using Figma-side code (code.ts on Figma docs) and sandboxed UI code (index.html on Figma docs). This template keeps the two sides separate (src/ui
and src/plugin
) but keeps common code available via src/common
.
Communicative: Plugin and UI code can communicate via postMessaging. This boilerplate has a built-in postMessage handler to send messages between the plugin and UI. (See /src/ui/lib/components/Message.svelte for code source and examples)
Iterative: Configure your figma.manifest.ts credentials just once. Run npm run build
and your plugin is ready to publish via your /dist
folder!
One File: Figma UI plugins accept only a single file each for Figma-side code (js) and UI-side code (html), which makes deployment of multiple files linked to each other impossible. This template is configured with vite-single-file to bundle or inline files, imports, vectors and more.
Figma's Icons: This boilerplate is configured with Figma's icon library for consistency and ease of use. Just use the <FigmaIcon />
component to render an SVG icon from the library. (See /src/ui/lib/components/figma-icons/FigmaIcon.svelte for code source and examples)
Tailwind-ready: This boilerplate is configured with tailwindcss and postcss for out-of-the-box utilities and styling.
npm install
Plugins
> Development
> New Plugin...
and follow the promptsmanifest.json
into the figma.manifest.ts
file in this repository's root foldernpm run dev
to build the plugin. This command will watch for changes and rebuild the plugin automatically, updating Figma's plugin instance with the changes.npm run build
and upload the /dist
folder to the Figma Developer Console/dist
folder, which is ignored by Git. This folder is what you upload to the Figma Developer Console when publishing your plugin.