I am trying to highlight a substring that occurs in a lightning tree. This substring is entered by the user. An example of this behavior can be seen in the org setup page in the left column as seen in the image.

Image with substring highlighted based on entered text

I have tried adding the <mark> tag to the substring in the label of the objects which have that substring in their label, but it doesn't read as html but as just a part of the string. The end result can be seen in the below image.

result of adding mark to the item label

I've tried other tags and all of them just show as a part of the label and aren't read as html code.

1 Answer 1


The library lightning-tree element doesn't support HTML inside elements or any other way of marking text. You'd want to use the Tree blueprint and create your own component to support this kind of functionality.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .