baackgroundColor property for miro.board.widgets.create method

  • 12 May 2021
  • 5 replies

I have the following code to recursively create a custom sticky widget from a CSV inside a web plugin. 

"type": "sticker",
"style": {
"backgroundColor": "#ea94bb",
"fontFamily": "Bangers",
"textAlign": "right"
"text": data[i][filter],
"x": ( 220 * horizontal ),
"y": ( 220 * vertical )

Regardless of what color I substitute in the backgroundColor property, I cannot get the stickies to generate as that color. They always get created yellow. I have run this same method with the “shape” widget and I get the correct specified background color. 

It there some nuanced approach to coloring stickers that I am just overlooking? I have been through the API documentation at least two dozen times. 


Best answer by Anthony Roux 18 May 2021, 12:26

View original

5 replies

Userlevel 5
Badge +1

Hi @uxmccauley,


It can be a bit confusing but the background color parameter for stickers is different than the one for shapes. You can find it documented here.


In your case you need to replace backgroundColor by stickerBackgroundColor.


This should solve the issue.


Oh neato! Thanks so much. I will try that today. 

I tried that and I get this error. 


Guess what, I realized that I am an idiot. I moved that prop into the style object and it works great now! Let’s just find a way to dynamically add tags and life will be amazing. 

Userlevel 5
Badge +1

FYI: when using Styling, some elements are actually enums (this is the case for “textAlign”). You can take a look at this post to see how to use the Miro SDK enums. 


Not sure what you are trying to do with tags but you can easily tag stickers using something like:


let allStickers = await miro.board.widgets.get({type: 'sticker'})

miro.board.tags.create({title: 'Red tag', color: '#F24726', widgetIds: allStickers})