SanitizedHTML
Reference
SanitizedHTMLrenders an HTML string after cleaning it with DOMPurify, so scripts and unsafe attributes are removed.- It is used for text that contains simple markup, for example a column title such as
Device <br/> Classesthat must show on two lines instead of showing the tag as text. - It renders a
div. To get the same font and line height as the standard grid headers, wrap it inText.
Props
html- Type:
string - Required: Yes
- Description: The HTML string to render.
- Type:
Usage Example
function Example() {
const { protrakComponents } = React.useContext(customWidgetContext);
const { Text, SanitizedHTML } = protrakComponents;
const category = 'Device <br/> Classes';
return (
<Text title={category.replace(/(<([^>]+)>)/gi, '')} style={{ fontWeight: 'bold' }}>
<SanitizedHTML html={category} />
</Text>
);
}