newsletter-builder
  • Type to search the documentation.

Getting started

Installation

Install the package, import the styles and set up Next.js, Vite or any React app.

Install the package

terminal
npm install newsletter-builder-react

Peer 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.

app/layout.tsx
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.

components/editor.tsx
'use client'

import { NewsletterBuilder, createWelcomeTemplate } from 'newsletter-builder-react'

export function Editor() {
  return (
    <div style={{ height: '100vh' }}>
      <NewsletterBuilder initialDocument={createWelcomeTemplate()} />
    </div>
  )
}

Entry points

Package exports