Hello,
I am trying to display HTML content in a Text Label component, and I have used the following code:
"This is a bold word"
However, it is still displaying as a simple string and not applying any HTML formatting. I followed the example from this documentation:
HTML in Vision Components
Is there a solution for enabling HTML rendering in the Text Label component?
Thank you.
Your sceenshot is showing a Perspective screen and component. If you want to display HTML text in perspective you need to use a markdown component and set props.markdown.escapeHtml
to false
3 Likes
More explicitly: You linked a section of the manual talking about Vision, one of the two different HMI/visualization systems Ignition supports. Vision has been around for a lot longer than Perspective, and works in a fundamentally different way, as it's backed by Java Swing.
Perspective, which is what you're using in the screenshot you posted, is our much newer visualization system that its backed by web rendering technologies, specifically React. You cannot embed arbitrary HTML inside React rendering stacks, because it would interfere with the rendering process. If you just want to display a text string with some formatting, consider using the Markdown component as Ryan mentioned, but not modifying the escapeHtml
property, and just using Markdown formatting inline on your text.
4 Likes
Thank You!
I want to sincerely thank Ryan White and everyone who took the time to help me with this issue. Your insights were really helpful!
By using the Markdown component and setting props.markdown.escapeHtml to false, my issue was successfully resolved.
I truly appreciate the support and guidance from this amazing community. Thanks again!