These docs are for v1.0. Click to read the latest docs for v2.0.

interface-iboardwidgetscommands

Interface: IBoardWidgetsCommands

Commands related to widgets such creation, modification and metadata.

Hierarchy

  • IBoardWidgetsCommands

Index

Methods

Methods

__blinkWidget

__blinkWidget(widgets: InputWidgets): Promise<void>

Makes a widget perform a "blink" animation in the board.

experimental

Parameters:

NameType
widgetsInputWidgets

Returns: Promise<void>

A promise resolving if the widget was found.


__getIntersectedObjects

__getIntersectedObjects(pointOrRect: IPoint | IRect): Promise<IWidget[]>

Finds all widgets intersected in a specific area.

Requires scope: BOARDS:READ

experimental

Parameters:

NameType
pointOrRectIPoint | IRect

Returns: Promise<IWidget[]>

A Promise resolving with the widgets found in the requested area.


areAllWidgetsLoaded

areAllWidgetsLoaded(): Promise<boolean>

Checks if all widgets on the board had been loaded.

Returns: Promise<boolean>

A promise resolving after all the widgets in the board had been loaded.


bringForward

bringForward(widgetId: InputWidgets): Promise<void>

Brings a widget forward in the board (above other widgets)

Requires scope: BOARDS:WRITE
Requires BoardPermission.EDIT_CONTENT for current user

Parameters:

NameType
widgetIdInputWidgets

Returns: Promise<void>

A promise resolving after the widget was brought forward.


create

create<T>(widgets: OneOrMany<WidgetToBeCreated>): Promise<T[]>

Creates a widget in the board.
A type is required.

See IWidget for more information about the different type of widgets and their properties.

Requires scope: BOARDS:WRITE
Requires BoardPermission.EDIT_CONTENT for the current user

Example

miro.board.widgets.create({type: "sticker", text: "Hello world"})

Type parameters:

NameType
TIWidget

Parameters:

Returns: Promise<T[]>

A promise resolving into an array containing the newly created widgets.


deleteById

deleteById(widgetIds: InputWidgets): Promise<void>

Deletes a single widget from the board

Requires scope: BOARDS:WRITE
Requires BoardPermission.EDIT_CONTENT for current user

Parameters:

NameTypeDescription
widgetIdsInputWidgetsWidget to be deleted

Returns: Promise<void>

A promise resolving after the widget was deleted.


get

get<T>(filterBy?: Record<string, unknown>): Promise<T[]>

Get all the board widgets matching a filter filterBy.
filterBy uses https://lodash.com/docs/4.17.11#filter

See IWidget for more information about the different type of widgets and their properties.

Requires scope: BOARDS:READ

Example

const stickers = miro.board.widgets.get({type: "sticker"})

Type parameters:

NameType
TIWidget

Parameters:

NameType
filterBy?Record<string, unknown>

Returns: Promise<T[]>

A promise resolving into an array of widgets matching the filter


sendBackward

sendBackward(widgetId: InputWidgets): Promise<void>

Send a widget to the back (below other widgets).

Requires scope: BOARDS:WRITE
Requires BoardPermission.EDIT_CONTENT for current user

Parameters:

NameType
widgetIdInputWidgets

Returns: Promise<void>

A promise resolving after the widget was sent forward.


transformDelta

transformDelta(widgetIds: InputWidgets, deltaX?: undefined | number, deltaY?: undefined | number, deltaRotation?: undefined | number): Promise<IWidget[]>

Modifies the widgets position and rotation based on the passed parameters.

Parameters:

NameTypeDescription
widgetIdsInputWidgets-
deltaX?undefined | numberTranslation on the X axis.
deltaY?undefined | numberTranslation on the Y axis
deltaRotation?undefined | numberRotation of the widget Requires scope: BOARDS:WRITE Requires BoardPermission.EDIT_CONTENT for current user

Returns: Promise<IWidget[]>

A promise resolving into an array with the modified widgets.


update

update<T>(widgets: OneOrMany<{ [index:string]: any; id: string }>): Promise<T[]>

Modify one or many widgets in the board.
An id is mandatory.

See IWidget for more information about the different type of widgets and their properties.

Requires scope: BOARDS:WRITE
Requires BoardPermission.EDIT_CONTENT for current user

Type parameters:

NameType
TIWidget

Parameters:

NameType
widgetsOneOrMany<{ [index:string]: any; id: string }>

Returns: Promise<T[]>

A promise resolving into an array with the modified widgets.