Is there a min/max width and height for the dimensions of a plugin window? For example is it possible to make the plugin window very narrow (like 40 pixels for example), and make its height fill the height of the Figma application viewport?
Also, is it possible to “dock” the plugin window to either side (right, left, top, or bottom) of the Figma UI, so that it’s basically attached to one of these sides.
position: The position of the UI window. Defaults to the last position of the iframe or the center of the viewport. If specified, expects an X/Y coordinate in the canvas space (i.e matches x/y values returned by <PluginNode>.x and <PluginNode>.y)
Yes, sure. You can check the viewport and reposition the plugin window. But I believe that the user himself should decide where the plugin window should be.
Well, it depends on what the plugin does I have an idea for a plugin but in order for it to work well and have a good UX, it needs to behave more like a toolbar. That’s why I was asking about it being very narrow, and “docked” to a side of the Figma viewport.
But this is promising. I think the only limitation might be that only one plugin can run at a time. Hopefully Figma can take away that limitation, and allow maybe a few plugins to run at the same time (at least two lol).
Docking will be “possible” if you do it manually like you described. All we’re waiting for is for figma.ui.reposition() to officially become available and we’re good. (This will also allow for left edge window resizing.)
I’ve actually had everything prepared for docking in my plugin’s current dev version for a while, just waiting for this function.
The next step is to let us remove the plugin window’s shadow and give it a panel-like border, so that it looks like a docked panel.
Cool, good to see other folks wishing for a bit more versatility in how a plugin integrates with the rest of the Figma UI. Is your plugin out yet (the undocking version)? What does it do?
I found a way to dock a plugin using the reposition api. See it in use in my Plugin for Translation managment - Parrot.
Sadly there is a bug in the reposition function in Figma and there is no easy and robust way to get the xy position of the plugin atm - see Retrieve plugin UI position? and Get relative position of plugin UI window to main Figma window
So the solution i come up with involves a lot of little tricks. I am currently cleaning up the code and plan to publish it as a little library soon.