Is it possible to make text "bold" via web sdk?

  • 12 October 2023
  • 3 replies
  • 29 views

Userlevel 1
Badge +2

Dear team, your help is greatly appreciated :)


3 replies

Userlevel 3
Badge

Hi @Elad 

You can do so via the <b> html tag. The “content” property for createText supports multiple HTML tags including <b>. You can read more here: https://developers.miro.com/docs/websdk-reference-text#content

If you want to try a code snippet that will make a part of your text bold, you can try this one:

 

const text = await miro.board.createText({
content: '<p><b>This is a piece</b> of text to remind me that I always finish what I ...</p>',
style: {
color: '#1a1a1a', // Default value: '#1a1a1a' (black)
fillColor: 'transparent', // Default value: transparent (no fill)
fillOpacity: 1, // Default value: 1 (solid color)
fontFamily: 'arial', // Default font type for the text
fontSize: 14, // Default font size for the text
textAlign: 'left', // Default horizontal alignment for the text
},
x: 0, // Default value: horizontal center of the board
y: 0, // Default value: vertical center of the board
width: 300,
rotation: 0.0,
});

console.log(text);

 

Userlevel 1
Badge +2

Thanks for the reply it is working perfectly!

Userlevel 3
Badge

Happy to help :) 

Reply