Skip to main content

Working with Widgets

In order to ensure predictable and performant Widgets, here’s a list of things to keep in mind as you’re building them:

  1. A widget’s render function should depend only on values returned by useSyncedState OR useSyncedMap.
  2. Widgets appear the exact same to all users.
  3. The only way to update a widget is by updating its state, which will re-render the widget automatically.
  4. Many widgets can be in a file, but a user is only allowed to run one widget at a time.
  5. Widget code can be terminated at any time by the user / FigJam. Known events that would terminate widget code are:
  • a user leaves/closes the file
  • a user explicitly stops a long running widget via the visual bell
  • a user deletes the running widget
  • a user explicitly interacts with another widget in the file