Center align plugin container

How can I center align the plugin container, based on screen size?

There is no way to move it, unfortunately. Only the user can control where the plugin window is placed.

1 Like

Thanks :+1:

You can vote for a similar idea here: Handle plugin location from figma.ui

With the recent update to the Plugin API, this is now possible.

Code.js example:

let pluginWidth = 800,
	pluginHeight = 480,
	centerX = Math.round(figma.viewport.center.x - (pluginWidth / 2)),
	centerY = Math.round(figma.viewport.center.y - (pluginHeight / 2));

figma.showUI(
	__html__,
	{
		title: 'Plugin Name',
		width: pluginWidth,
		height: pluginHeight,
		position: {
			x: centerX,
			y: centerY
		}
	}
);
1 Like