Skip to main content
Question

How to apply bold to text range using API?

  • June 24, 2024
  • 1 reply
  • 113 views

Martyn_Bowis

How do you apply bold or fontWeight to a text range using the API?

The following works for underline:
textNode.setRangeTextDecoration(index, index + length, ‘UNDERLINE’);

But the following does not appear to work for bold:
textNode.setRangeTextStyleIdAsync(index, index + length, ‘bold’);

What is the correct way to use the API to format a range of characters within a text node please?

This topic has been closed for replies.

1 reply

Gleb
  • Power Member
  • 4708 replies
  • June 24, 2024

Use setRangeFontName

figma.com

Font name is family + style:

{ family: "Inter", style: "Bold" }


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings