Skip to content

ViewHtml

The ViewHtml component safely renders HTML content using DOMPurify for sanitization. It applies prose styling for better readability and prevents XSS attacks by cleaning potentially dangerous HTML.

The component automatically sanitizes all HTML content before rendering, ensuring that only safe HTML elements and attributes are displayed.

HTML Content

Rich HTML content with various elements and styling.

You can use bold, italic, and highlighted text. Press Ctrl + V to paste.

Features

  • Semantic HTML
  • Accessible markup
  • Clean structure

HTML is the foundation of the web.

const html = '
Hello
';
Element Purpose
<div> Container
<span> Inline

Last updated: Today

import { ViewHtml } from '@fintech-sandpit/ui/react';
const htmlContent = '<h1>Hello World</h1><p>This is safe HTML content.</p>';
return (
<ViewHtml html={htmlContent} />
);
NameTypeRequiredDefaultDescription
htmlstringYesThe HTML content to render. Will be sanitized using DOMPurify before display.