0

We have a requirement for applying bolding to particular words in a radio-group option. Is this possible with LWC?

eg.

There is a problem

There is no problem

Unfortunately we cannot reword the options to make them clearer as they legislated to be worded a particular way :(

I tried adding <b> in to the label but just ended up with that displayed

2

You would need to write a custom library function and use lwc:dom="manual" in order to create a custom renderer to support this type of functionality. There's simply no real way to dynamically create DOM components in LWC, or provide unescaped HTML (as aura:unescapedHtml), so you'd be left with writing a static resource that contains logic to render a custom DOM. It's not impossible, but it's going to be a lot more work than you'd probably like to invest in.

1
  • Thanks - figured that was the case. Told them about a week to implement it if they really wanted it. They decided capitalisation would have to do, but had to put the question out there to make sure I was not missing a hidden trick to do so.
    – Tony White
    Sep 7 '19 at 5:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.