Plugin API: method to highlight nodes without modifying the document
Summary
I'd like to request a Plugin API method that allows plugins to visually highlight nodes on the canvas — similar to the hover highlight shown when hovering over a layer in the Layers panel — without modifying the document tree or populating the undo history.
Use Case
In the plugin I'm developing, there are several scenarios where I need to visually indicate specific nodes to the user:
- Previewing targets before modification — When a plugin operation will affect multiple nodes, I want to highlight all potential targets so the user can review what will be changed before confirming the action.
- Visual node discovery — My plugin UI lists objects that match certain criteria. When the user hovers over or clicks an item in the plugin UI, I want to highlight the corresponding node on the canvas so they can quickly locate it visually, especially in complex files with many layers.
Current Limitations
- Selection (figma.currentPage.selection) — This works as a basic indicator but overwrites the user's actual selection, which is disruptive. It also doesn't distinguish between "selected for editing" and "highlighted for reference."
- Creating temporary overlay nodes — Drawing a highlight rectangle around the target node is visually effective, but every creation and deletion is recorded in the undo history. This pollutes the user's undo stack and can cause confusing behaviour if they undo past the plugin's cleanup.
- Plugin UI overlay — Drawing highlights in the plugin's iframe UI is possible but requires manually calculating canvas-to-screen coordinates and doesn't integrate with Figma's zoom or pan, making it fragile and complex to maintain.
Proposed API
A method such as:
figma.highlight(nodes: SceneNode[], options?: { color?: RGB, duration?: number })
figma.clearHighlights()
This would:
- Render a non-destructive visual indicator (e.g. a coloured outline) around the specified nodes
- Not create any document mutations or undo history entries
- Automatically follow canvas zoom and pan
- Optionally support custom colours to distinguish different highlight purposes
- Optionally auto-clear after a duration
Alternatives Considered
A more general-purpose solution could also work, such as:
A "transient layer" API that allows plugins to draw non-persistent visuals on the canvas
An option to suppress undo recording for specific operations (e.g. figma.skipUndo(() => { ... }))
Either approach would open up a wide range of plugin UX improvements beyond just highlighting.
Thank you for considering this!
