Center artboard in visible area


I have created a artboard and now I need to center it in the visible área of the xd!

Do I use moveInParentCoordinates, if so related to what?


Maybe you just need to use viewport.scrollIntoView(artboardNode) ?


Just to clarify: Do you want to actually move the artboard to the center of the screen (i.e., in relation to other artboards) or just move the view so that the artboard appears in the center of the screen (in that case, @cpryland’s answer should get you what you’re looking for…)

(please note that viewport is a module, meaning you’ll have to use const viewport = require('viewport'); to use it :slightly_smiling_face:)

1 Like

Hello, Thanks @pklaschka …I think @cpryland answer is what I need, thanks!

1 Like

That’s it @cpryland, thank you!

1 Like

I know that there is a forum for non plugin XD questions but I saw this API before and I thought that there must be a way to scroll an artboard or element into view through XD UI but I can’t find it. I thought if you double click a layer or artboard it brings it into view and I think I got it to work once but not anymore.

Any idea how to do this through the UI?

If you double-click an artboard in the Layers panel, XD will scroll & zoom to it. If you select any other layer in the Layers panel and it is out of view, you can use the “Zoom to Selection” command (Cmd-3) to scroll it into view too.

Without a plugin, there’s no way to scroll to the selection without also changing the zoom level though.