Getting started
Installation
Install the package, import the styles and set up Next.js, Vite or any React app.
Install the package
npm install newsletter-builder-reactPeer dependencies are react and react-dom version 18 or 19. There are no other runtime dependencies. The package is written in strict TypeScript and ships its own types.
Import the styles
The editor chrome is styled by a single plain CSS file scoped under .nb-root. It does not require Tailwind and will not leak into your app.
import 'newsletter-builder-react/styles.css'Next.js App Router
Editor components use state and browser APIs, so render them from a client component. The compiler is pure and can run in Server Components, route handlers and server actions.
'use client'
import { NewsletterBuilder, createWelcomeTemplate } from 'newsletter-builder-react'
export function Editor() {
return (
<div style={{ height: '100vh' }}>
<NewsletterBuilder initialDocument={createWelcomeTemplate()} />
</div>
)
}