Creating a custom node
Custom extensions useEmailNode, which extends TipTap’s Node with one extra required
method: renderToReactEmail(). Use parseHTML() to recognize pasted or imported HTML,
renderHTML() to control how the node appears in the editor, and renderToReactEmail() to
control how it is exported by composeReactEmail.
Here’s a complete example of a custom “Callout” node that renders as a highlighted block:
Registering the extension
Add your custom extension to the extensions array alongsideStarterKit:
Inserting custom nodes
Use the editor’sinsertContent command to programmatically insert your custom node:
Complete example
Here’s the full editor setup with the custom Callout extension, a toolbar, and a bubble menu:Wrapping existing TipTap extensions
BothEmailNode and EmailMark provide a .from() method that wraps an existing TipTap
extension with email serialization support. This is useful when you want to reuse a community
TipTap extension and add email export support without rewriting it.
Configure and extend
BothEmailNode and EmailMark support TipTap’s standard customization methods:
Examples
See custom extensions in action with a runnable example:Custom Extensions
Custom Callout node with EmailNode.create, toolbar insertion, and bubble menu.