Unsupported

Unsupported.Unsupported

Unsupported

The Miro Web SDK doesn't yet support all board items. Unsupported items are grouped under a generic category called unsupported items.
We're planning to gradually support them in future releases.

At the moment it's not possible to create, update, or delete these items programmatically.
Currently, the Miro Web SDK supports reading and updating xand y coordinates of unsupported items.

Unsupported itemDescription
DocumentEmbeds a document—for example, a PDF file, a presentation slide deck, or a Google doc—in a board so that it is possible to view it from within the board.
EmojiAdds emojis to a board.
KanbanCreates Kanban boards that can be populated with Cards to manage product delivery.
Mind MapHelps visually represent thought processes and hierarchical relationships.
MockupEnables using wireframes to create mock-ups to prototype interaction interfaces quickly and efficiently.
StrokeIt simulates a pen stroke to draws lines on a board.
SVGCreates icons from Scalable Vector Graphics format XML.
Table textEnables adding, editing, and deleting text from tables on a board.
TableEnables adding, editing, and deleting tables on a board.
USMUser Story Mapping (USM) helps structure, organize, and plan user tasks and product releases.
WebScreenEnables taking a screenshot of a web page in Chrome, and then saving it to a library. The screenshot can then be added to a board. It's part of the Miro Web Clipper web browser extension.

Table of contents

Properties

Methods

Properties

type

Readonly type: UnsupportedType

Defines the type of item.
Item type is useful to retrieve specific items from a board.
For example, you can fetch all card and shape items from the board, and then carry out an action on them.

Example:

// Get all items from the board
const items = await miro.board.get();

// Count all card and shape items on the board
let cards = 0;
let shapes = 0;

items.forEach((items) => {
  switch (items.type) {
    case 'card':
      cards++;
    case 'shape':
      shapes++;
  }
});

// Output to the console the total amount of card and shape items
console.log(`The current board has ${cards} cards and ${shapes} shapes.`);

Overrides

BaseItem.type


id

Readonly id: string

Unique ID of the item, assigned automatically upon creation.

Example: 3658432978520043388


origin

origin: "center"

origin marks:

  • The positioning reference point of a board item.
    This is the point used to calculate the x and y coordinates of an item when it's positioned on the board, or when it's a child inside a parent item.
  • The rotation pivot point of a board item that supports rotation.

origin accepts only one value: center.
Any other value throws an error.


parentId

Readonly parentId: null | string

If an item is a child of another item, the child's parentId returns the unique identifier of the corresponding parent item.
If an item has no parent, its parentId is null.

You can use the value to retrieve a tree structure when items are nested inside containers.
For example, sticky notes inside frames.


createdAt

Readonly createdAt: string

Timestamp

Date and time when the item was created.

Format: UTC, ISO 8601.
Includes a trailing Z offset.

Example: 2021-05-18T07:59:01Z


createdBy

Readonly createdBy: string

Miro users are automatically assigned a unique ID.

createdBy contains the ID of the user who created the item.

Example: 3658432978520043388


modifiedAt

Readonly modifiedAt: string

Timestamp

Date and time when the item was last modified.

Format: UTC, ISO 8601.
Includes a trailing Z offset.

Example: 2021-05-18T07:59:01Z


modifiedBy

Readonly modifiedBy: string

Miro users are automatically assigned a unique ID.

modifiedBy contains the ID of the user who applied the most recent edit to the item.

Example: 3658432978520043388


x

x: number

The x-axis coordinate of an item is the horizontal distance in dp of the center point of the item from the center point of the board.

The center point of the board has x: 0 and y: 0 coordinates.

Default: 0

See also:


y

y: number

The y-axis coordinate of an item is the vertical distance in dp of the center point of the item from the center point of the board.

The center point of the board has x: 0 and y: 0 coordinates.

Default: 0

See also:

Methods

sync

sync(): Promise<void>

sync propagates to the board any changes to item and tag properties.
After updating the properties of an item or a tag, sync it with the board to:

  • Propagate to the board the changes applied to the item or to the tag.
  • Make the changes visible on the board.

All board items and tags require sync to make any changes to their properties visible on the board.

For more information and examples, see Update and sync item properties.

Example:
(The code example updates a text item using sync.
The same mechanism applies to and works in the same way for all supported board items.)

// Create an item.
// In this case, a text item.
const text = await miro.board.createText({
  content: '<p>This is a piece of text to remind me that I always finish what I ...</p>',
  style: {
    fillColor: 'transparent',
    textAlign: 'left',
  },
  x: 0,
  y: 0,
  width: 450,
  rotation: 0.0,
});

// Update the board item by modifying the values of its properties.
// In the text item case, the updated properties modify content, background color, and rotation of the item.
text.content = 'A fourteneer is "A line that rumbles on like this for being a bit too long."';
text.style.fillColor = '#a9fe65';
text.rotation = 180.0;

// Call 'sync' to make the changed board item properties visible on the board.
await text.sync();

// Output the updated board item to the developer console.
console.log(text);

Example:
(The code example updates a tag using sync.
The same mechanism applies to and works in the same way for all supported board items.)

// Create a tag.
const todo = await miro.board.createTag({
  title: 'todo',
  color: 'yellow',
});

// Create a sticky note and attach the tag to it.
const stickyNote = await miro.board.createStickyNote({
  content: 'sticky note with tag: "todo"',
  tagIds: [todo.id],
});
console.log(stickyNote.tagIds); // => ['3074457345627244742']

// Update the tag properties: title and color.
todo.title = "won't fix";
todo.color = 'green';

// Call 'sync' to make the changed tag properties visible on the board.
await todo.sync();

// Output the updated tag to the developer console.
console.log(todo);

Returns

Promise<void>


getMetadata

getMetadata(): Promise<AppData>

Experimental feature Experimental

Fetches board item metadata, stored per app, for the specified key.
The response contains the metadata value assigned to the requested key.

To fetch all the metadata for a board item, invoke the method without passing any arguments.
The response contains all the metadata assigned to the board item as key/value pairs.

An app can access only the board item metadata that it sets. It cannot access metadata set by other apps.

getMetadata and setMetadata are available for the following board items:

  • Card
  • Connector
  • Embed
  • Image
  • Preview
  • Shape
  • Sticky note
  • Text

The methods aren't available for the following board items:

ℹ️ Note:

Example:

// Get the board item you want to retrieve metadata from.
const [geoCard] = await miro.board.get({type: 'card'});

// Set item metadata for an imaginary geocaching game, and store it to the retrieved card item.
await geoCard.setMetadata('leaderboard', ['Ziltoid', 'Howard', 'Paul']);

// Get the specific 'leaderboard' metadata from the card item.
const leaderboard = await geoCard.getAppData('leaderboard');

// Get all the metadata from the card item by passing no arguments.
await geoCard.getMetadata();

Returns

Promise<AppData>

getMetadata<T>(key): Promise<T>

Type parameters

NameType
Textends AppDataValue

Parameters

NameType
keystring

Returns

Promise<T>


setMetadata

setMetadata<T>(key, value): Promise<T>

Experimental feature Experimental

Adds board item metadata to make it available on the board that the app is running on.
An app can access only the board item metadata that it sets. It cannot access metadata set by other apps.

Board item metadata is stored in the item it refers to. Therefore:

  • When duplicating an item, the metadata is copied to the new item.
  • When deleting an item, the corresponding metadata is removed as well.

Board item metadata is synced across, and available to, all the users who can:

  • Access and view the board that the app is running on, AND
  • Run the app on the board.

AppMetadata is a key/value-pair object. It can contain values with the following data types:

  • string
  • number
  • boolean
  • Object
  • Array

getMetadata and setMetadata are available for the following board items:

  • Card
  • Connector
  • Embed
  • Image
  • Preview
  • Shape
  • Sticky note
  • Text

The methods aren't available for the following board items:

ℹ️ Note:

  • To access board item metadata, apps require the boards:read permission.
  • To store board item metadata, apps require the boards:write permission.
  • You can overwrite the value of an existing key inside AppMetadata: if you pass the same key multiple times with different values, only the last/most recent value is stored with the key.
  • After setting a key, you cannot delete it; you can only update it.
    However, you can delete the corresponding value by setting it to null, or to an empty value ('').
  • You can assign an empty array ([]) as the value of a key. It's returned as an empty array.

Example:

// Get the board item you want to set metadata to.
const [geoCard] = await miro.board.get({type: 'card'});

// Set item metadata for an imaginary geocaching game, and store it to the retrieved card item.
await geoCard.setMetadata('geoData', {
  name: 'null',
  coordinates: {
    latitude: '33.950278',
    longitude: '-105.314167',
  },
  lastFound: '1947-07-08',
  content: true,
  difficulty: 5,
  keywords: ['x-files', 'truth-is-out-there', 'area-51', 'roswell', 'aliens'],
  geoCache: [
    {
      name: 'UFO',
      description: 'Severely damaged unidentified flying object. ',
    },
    {
      name: 'Alien',
      description: 'Remains of an alien life form.',
    },
    {
      name: 'Artifacts',
      description: 'Tools, equipment, and other items found at the crash site.',
    },
    {
      name: 'Edibles',
      description: 'The alien was likely as high as a kite when they crashed. Typical.',
    },
  ],
});

// Get the specific 'geoData' metadata from the card item.
// The response contains the metadata value assigned to the key.
const geoCardGeoData = await geoCard.getMetadata('geoData');

// Get all the metadata from the card item.
// The response contains all the metadata assigned to the board item as key/value pairs.
const geoCardAllMetaData = await geoCard.getMetadata();

// Clear the metadata about the imaginary geocaching game by assigning 'geoData' an empty object.
await geoCard.setMetadata('geoData', {});

// If the card item metadata has a top-level key, you can clear all the metadata
// from the card item by assigning the top-level key an empty object.
// In this example, the top-level key name is 'metaData'.
await geoCard.setMetadata('metaData', {});

Type parameters

NameType
Textends AppData

Parameters

NameType
keystring
valueAppDataValue

Returns

Promise<T>


What’s Next

Go to board to explore the methods to perform CRUD operations on board items, to set and get metadata, and to retrieve user information.