Introduction
Learn how to install the package, import the CSS bundle, render the controlled editor, and validate your integration across CRA, Vite, and Next.js—all in one guided checklist.
This guide walks you through every prerequisite and first-run task: installing the package, importing the CSS, wiring the controlled component, configuring height/width defaults, and verifying framework specifics for Next.js, CRA, and Vite. Follow the sections below to bootstrap state management, render your first editor instance, and discover the next docs to read once you are live.
Installation
Select your preferred workflow—CLI or package manager—to add the editor to your project.
npm install @webbycrown/react-advanced-richtext-editoryarn add @webbycrown/react-advanced-richtext-editorRequirements
- React 16.8 or newer Hooks (useState, useEffect, useCallback) drive the editor’s controlled state. Older React versions lack those primitives and will fail to compile the examples.
- ReactDOM 16.8 or newer Portal-based UI (modals, floating toolbars) and concurrent rendering fixes rely on the matching ReactDOM release—keep React/ReactDOM versions in sync to avoid hydration warnings.
- Modern evergreen browser The editor leans on
contentEditable, Selection API, Clipboard API, and ResizeObserver. Ensure Chrome, Edge, Firefox, or Safari within the last two years; IE11 is not supported.
Basic Usage
1. Import the Editor
// Import the Editor component
import Editor from '@webbycrown/react-advanced-richtext-editor';
// Import the default stylesheet (required)
import '@webbycrown/react-advanced-richtext-editor/dist/styles.css';2. Use in Your Component
import React, { useState } from 'react';
import Editor from '@webbycrown/react-advanced-richtext-editor';
// Import the default stylesheet - required for proper editor appearance
import '@webbycrown/react-advanced-richtext-editor/dist/styles.css';
function App() {
// Store HTML content in state
const [content, setContent] = useState('');
return (
<Editor
value={content} // Current HTML content
onChange={setContent} // Update state when content changes
height={400} // Editor height in pixels
width="100%" // Full width of container
/>
);
}Get started with the React Advanced Rich Text Editor in just a few lines of code.
Type rich text here and manage the HTML string in your React state.
This is a quick example showing the default editor with all features enabled.
💡 Next.js Tips:
- For Server Components, create a separate client component file for the editor
- If you encounter hydration errors, ensure the editor is only rendered on the client side
- Use dynamic imports with
ssr: falseif you need to conditionally load the editor
First Steps
1. Import the component and styles
import Editor from '@webbycrown/react-advanced-richtext-editor'; // Import the default bundle
import '@webbycrown/react-advanced-richtext-editor/dist/styles.css'; // Import the default stylesheet2. Render the editor
<Editor/> // Render the editorNext Steps
Framework Compatibility
Next.js
The editor works seamlessly with Next.js. For App Router (Next.js 13+), make sure to use it in a Client Component. The editor requires browser APIs that are only available on the client side.
Setup Steps:
- Install the package
- Add
'use client'directive at the top of your file - Import the Editor and stylesheet
Note: If you’re using the Pages Router (Next.js 12 and below), you can use the editor directly without the 'use client' directive, as all components are client-side by default.
// Required for Next.js App Router (editor uses browser APIs)
'use client';
// Import useState hook
import { useState } from 'react';
// Import the Editor component
import Editor from '@webbycrown/react-advanced-richtext-editor';
// Import editor styles
import '@webbycrown/react-advanced-richtext-editor/dist/styles.css';
export default function Page() {
// Store HTML content in state
const [content, setContent] = useState('');
return (
<Editor
value={content} // Current HTML content
onChange={setContent} // Update state when content changes
height={500} // Editor height in pixels
/>
);
}Get started with the React Advanced Rich Text Editor in just a few lines of code.
Type rich text here and manage the HTML string in your React state.
This is a quick example showing the default editor with all features enabled.
💡 Next.js Tips:
- For Server Components, create a separate client component file for the editor
- If you encounter hydration errors, ensure the editor is only rendered on the client side
- Use dynamic imports with
ssr: falseif you need to conditionally load the editor
Create React App
Create React App (CRA) is the official way to create single-page React applications. The editor integrates seamlessly with CRA projects without any additional configuration.
Setup Steps:
- Install the package
- Import the Editor and stylesheet in your component
Note: CRA handles all the build configuration automatically, so you can focus on building your application.
// Import React and useState hook
import React, { useState } from 'react';
// Import the Editor component
import Editor from '@webbycrown/react-advanced-richtext-editor';
// Import editor styles
import '@webbycrown/react-advanced-richtext-editor/dist/styles.css';
function App() {
// Store HTML content in state
const [content, setContent] = useState('');
return (
<div className="App">
<Editor
value={content} // Current HTML content
onChange={setContent} // Update state when content changes
height={500} // Editor height in pixels
/>
</div>
);
}
export default App;Get started with the React Advanced Rich Text Editor in just a few lines of code.
Type rich text here and manage the HTML string in your React state.
This is a quick example showing the default editor with all features enabled.
💡 Create React App Tips:
- The editor works out of the box with CRA – no additional webpack configuration needed
- If you need to customize the build, you can use react-app-rewired or eject
- All editor styles are automatically included when you import the CSS file
Vite
Vite is a next-generation frontend build tool that provides a faster and leaner development experience. The editor works perfectly with Vite’s React template.
Setup Steps:
- Install the package
- Import the Editor and stylesheet in your component
Benefits: Vite offers instant server start, lightning-fast HMR (Hot Module Replacement), and optimized builds. The editor’s CSS will be automatically processed by Vite’s CSS handling.
// Import useState hook
import { useState } from 'react';
// Import the Editor component
import Editor from '@webbycrown/react-advanced-richtext-editor';
// Import editor styles
import '@webbycrown/react-advanced-richtext-editor/dist/styles.css';
function App() {
// Store HTML content in state
const [content, setContent] = useState('');
return (
<Editor
value={content} // Current HTML content
onChange={setContent} // Update state when content changes
height={400} // Editor height in pixels
/>
);
}
export default App;Get started with the React Advanced Rich Text Editor in just a few lines of code.
Type rich text here and manage the HTML string in your React state.
This is a quick example showing the default editor with all features enabled.
💡 Vite Tips:
- Vite automatically handles CSS imports – no additional configuration needed
- For production builds, Vite optimizes the editor bundle automatically
- If using TypeScript, the editor includes full type definitions
- Vite’s fast HMR means editor changes reflect instantly during development