2023-09-12 changelog

Miro Web SDK 2.0 introduces `findEmptySpace()` helper method

What's new

findEmptySpace()

We're excited to announce the experimental release of the findEmptySpace() helper method, available in the Web SDK's experimental namespace.

Use the findEmptySpace() method to identify an area on the board that doesn't overlap with existing board items. The method takes x, y parameters to define the starting point for finding empty space. You can also set a width and height value to define the size of the desired space, and optionally, an offset value.

Example

const position = await miro.board.experimental.findEmptySpace({
  x: 0,
  y: 0,
  width: 200,
  height: 200,
});
// If the board is empty then
// position has the following properties:
// {
//   x: 0,
//   y: 0,
//   width: 200,
//   height: 200
// }

await miro.board.createStickyNote({
  content: "I'm not overlaping any existing widgets",
  ...position,
});

For more information, see findEmptySpace().