API

Rendering rich text

RichText renders TipTap JSON without dangerouslySetInnerHTML.


@interactive-inc/cms/react ships RichText, which renders stored TipTap JSON structurally to React elements. Text becomes React children (auto-escaped), so stored content can never inject raw HTML or scripts.

import { RichText, richTextToPlain } from "@interactive-inc/cms/react"

<RichText json={doc.data.body} />
const excerpt = richTextToPlain(doc.data.body)

Unknown nodes still render their children, so content is never dropped. richTextToPlain flattens a document to plain text, which is also what the search index stores.