Skip to main content

2) Update an item's properties with `sync()`



20%

Time to complete

Time to complete ~5 minutes

Learning objective

Learning objective After completing this onboarding task, you'll be able to:

  • Initiate and manage updates to board items using the sync() method.

Let’s update the properties of a board item and see the changes take place.

Action: update your sticky note

Review the snippet in the code editor below and run it. The code below will:

  1. Update your sticky note's color to light blue.
  2. Change your sticky note's position to x = 100, y = 100.

ℹ️ Note: Updates require two steps:

  1. Change the property value.
  2. Call sync() on the item to make the changes effective.
const stickyNote = await miro.board.createStickyNote({ content: 'Hello' }); // First, you change the values of the properties you want to update. stickyNote.content = 'Updated sticky note'; stickyNote.style.fillColor = 'light_blue'; stickyNote.x = 100; stickyNote.y = 100; // Second, you sync the item to make the changes effective. await stickyNote.sync();

Let's wrap up

Let's wrap up In this onboarding task, you:

  • Updated the properties of an existing item on a Miro board, using the sync() method.

Now that you've updated your sticky note, let's run an app inside a Miro board!

See also