Docs Menu
Docs/Guides/Custom Content & HTML Sanitization
Updated October 2026

Custom Content & HTML Sanitization

Render bespoke JSX components, sanitized rich HTML, user avatars, and custom badge icons.

When standard title and description cards do not fit your product design, toastory provides custom component renderers and safe HTML injection.

Custom JSX Component

tsx

toast.custom((id) => (

Developer

Deployment Ready

PR #48 passed all 12 checks.

)); `

Safe HTML Rendering

HTML strings passed via the html option are automatically sanitized with DOMPurify when available, eliminating XSS vulnerabilities:

typescript
toast.info('Invoice generated', {
  html: '<strong>Invoice #1042</strong> has been generated for <em>$240.00 USD</em>.',
});

Want to test these options live?

Launch the interactive playground to experiment with themes, positions, and live generators.

Open in Playground →