A Figma plugin template using Vite and React with TypeScript.
npm installnpm run devThis will:
- Start Vite dev server for the UI with hot reload
- Watch and rebuild plugin code on changes
npm run buildThis creates production builds in the dist/ folder.
- Open Figma Desktop App
- Go to
Plugins→Development→Import plugin from manifest... - Select the
manifest.jsonfile from this project - Run the plugin from
Plugins→Development→My Figma Plugin
src/
├── plugin/ # Plugin sandbox code (runs in Figma)
│ └── code.ts
├── ui/ # React UI (runs in iframe)
│ ├── App.tsx
│ ├── App.css
│ └── main.tsx
└── types/ # Shared types
└── messages.ts
The plugin uses postMessage API:
- UI → Plugin:
parent.postMessage({ pluginMessage: {...} }, '*') - Plugin → UI:
figma.ui.postMessage({...})