How to add rich text to textBlock?

Hello,

Is it possible to insert text with multiple different styles into a single TextBlock?
The textBlock control supports variables for enabling underlines and strikethroughs for the entire text, but I would like to independently change the style for individual words or sentences on a same TextBlock.

While browsing through the forums in search of an answer, i’ve come across this post about implementing such feature from scratch, but the project seems to have been dormant for the past 2 years, with no trace of it in the extensions repo. Is the project still being worked on? If not, are there resources about how to implement this feature myself?

Thank you for your time.

1 Like

Hi,
As much as I regret it, this project didn’t make it through. I tried to ask the Team to reinstate it and take ownership of a simplified version (because the project scope had gone too far - in my opinion - probably also why it had been abandonned :thinking:) But no luck there at this time (not that I would know).
Instead, there has been an alternate solution that’s been developed by a community member.

https://doc.babylonjs.com/communityExtensions/htmlMesh

However, this isn’t specific to the GUI. So, it’s not really a replacement.

Interestingly enough, the figma to BJS GUI plugin/project (another community project) actually did successfully implement a ‘rich text’.
https://doc.babylonjs.com/communityExtensions/figmaToBabylonJS

So, it definetely IS possible.

Then, if you wanna push for the ‘native’ BJS GUI ‘rich’-textBlock, summoning the Team @Deltakosh @PatrickRyan for version 8 :grin:, know that you already have my upvote :+1: :stuck_out_tongue_closed_eyes:

2 Likes

Hi,

I’ve already taken a look at the HTMLMesh, but unfortunately it doesn’t quite match my needs. I will take a look at this Figma tool, but my project creates the UI procedurally depending on some user input, and I don’t know if Figma will be able to give me the result I need in the short time limit I have on my project. I think I will have to stick with instacing multiple TextBlocks for each style for now.

Still, thank you for taking the time to help me :slight_smile:

1 Like

Oh, so you already know of this trick. I suppose you saw the multiple posts in the forum. I’m afraid it’s the only way at this moment. The only one I would know about.

1 Like