Changing style for a specific set of words/characters

Hello,

Wondering if anyone knows how to apply a specific style only to a part of the options text?

There's an example of how to change the background and font weight here, but it changes the style of the whole text. What if I just want to change the style of a word or a few characters?

Many thanks in advance,
Sofia

Hi! Instead of a "text", you can also provide a key "html" to the options, which lets you use more flexible styling. So you could do something like:

options = [
    {"id": "1", "html": "<strong>bold</strong> not bold"}
]

Other text-based interfaces like the classification UI also let you pass in "html" instead, and you can keep a separate property "text" (or something custom) to store the original plain text value if needed.

Another feature we'll that will be included in the next release (already available as a nightly pre-release is the ability to style individual tokens in the ner_manual UI. So you can include a "style" for any token and define custom CSS properties to style it.

1 Like

Thank you so much @ines! :slight_smile: