A simple table widget that showcases useSyncedMap to support concurrent updates to the widget and the key prop.
Code organization:
| dir / path | description |
|---|---|
| widget-src/ | This is where the widget code lives |
| widget-src/code.tsx | Main entry point for the widget code |
| widget-src/tsconfig.json | tsconfig for the widget code |
| dist/ | Built output goes here |
- The widget code is built using esbuild to bundle widget-src/code.tsx into one file.
- Make a copy of this folder
- Update manifest.json, package.json and package-lock.json where it says
name: ... - Install the required dependencies
npm ci
- "Import widget from manifest"
- Build code
npm run build - Choose your manifest.json
The quickest way to build your widget during development is by running:
npm run devThis command starts the follow in watch mode:
- typechecking for widget-src
- building for widget-src
While this command is running, any changes to widget-src/code.tsx will be compiled into the dist/code.js file that is referenced by the manifest.json.
| script | description |
|---|---|
| npm run build | one-off full build of the widget |
| npm run test | typecheck the widget code |
For more information about widgets, please visit the widget documentation at https://www.figma.com/widget-docs.
If you find anything bugs or have any questions, please reach out via https://www.figma.com/widget-docs/get-help/.