Create a widget not on top of another widget

  • 27 March 2021
  • 3 replies

Userlevel 1

When using the Create Widget endpoint, all widgets become stacked on top of each other toward the middle of the board. Without calling all widgets prior and determining the free space and setting the x and y coordinate, how are you to create widgets NOT right on top of eachother?


Best answer by Max Harper 27 March 2021, 14:15

View original

3 replies

Userlevel 7
Badge +5

@Fry  you could increment off day/time as an ever changing variable. … I can think of crazier ideas. 🤪

Userlevel 1

@Max Harper Thank you very much or the reply. Unfortunately, the app I am building is a trigger based workflow automation process so each run of the “Create Widget” endpoint would be a separate execution. The idea of this platform is not persist data, so storing all the X and Y values isn’t really possible or encouraged.

The workflow runs should be fast and light so doing a GET of all widgets and running them through some sort of evaluator to determine “free space” is also not possible. 

I just wish that there was some sort of server-side processor on Miro that would put the widgets as close to the center as possible in the nearest “free space”.


Thanks again for your response as it validates that there really isn’t anything I can do but just add a bit of randomness to the X and Y. 

Userlevel 7
Badge +5


I know you say “without setting x and y” ...  

What I do sometimes is build widget objects in a loop and use an iterator (‘for loop’ i, i++) to add a little x and a little y (<100%of width or height X i ) to each position. As you create them push each onto an array and send that array to the create endpoint. That’ll make a cascading stack. 

Add (>100% of width or height X iterator)  to each and you’ll get them laying out in an array. 

Get fancy, modulo divide them, i rows of j elements, and place them in a matrix…. 


That kind of thing...