Syncfusion React Rich Text Editor
A WYSIWYG (What You See Is What You Get) editor for creating and formatting rich content as HTML or Markdown. Supports toolbars, media insertion, AI assistance, smart editing features, form validation, and deep customization.
When to Use This Skill
- Setting up a rich text / WYSIWYG editor in a React app
- Configuring toolbar items, types, or positions
- Switching between HTML and Markdown editor modes
- Inserting images, video, audio, or files
- Working with smart editing features: emoji, slash menu, mentions, mail merge
- Integrating AI assistant into the editor
- Handling editor value: get, set, two-way binding, auto-save, import/export
- Applying paste cleanup, form validation, or read-only mode
- Customizing styles, accessibility, or keyboard shortcuts
Quick Start
npm install @syncfusion/ej2-react-richtexteditor
npm install @syncfusion/ej2-tailwind3-theme
src/App.css - add CSS imports
@import '../node_modules/@syncfusion/ej2-tailwind3-theme/styles/rich-text-editor/index.css';
import './App.css';
import {
HtmlEditor, Image, Inject, Link,
QuickToolbar, RichTextEditorComponent, Toolbar
} from '@syncfusion/ej2-react-richtexteditor';
function App() {
return (
<RichTextEditorComponent height={450}>
<Inject services={[Toolbar, Image, Link, HtmlEditor, QuickToolbar]} />
</RichTextEditorComponent>
);
}
export default App;
Module Injection Reference
Inject only the modules your app needs — this keeps the bundle lean.
| Module |
What it enables |
Toolbar |
Toolbar rendering and commands |
HtmlEditor |
HTML editing mode (default) |
MarkdownEditor |
Markdown editing mode |
Link |
Hyperlink insert/edit/remove |
Image |
Image insertion and management |
Video |
Video insertion |
Audio |
Audio insertion |
Table |
HTML table insert/edit |
QuickToolbar |
Floating toolbar for images/links |
PasteCleanup |
Clean up pasted content formatting |
ClipboardCleanup |
Clean clipboard on copy/cut |
FileManager |
File browser for server-side images |
Resize |
Resizable editor area |
Count |
Character count display |
EmojiPicker |
Emoji search and insert |
SlashMenu |
Slash / command menu |
ImportExport |
Import Word, export Word/PDF |
CodeBlock |
Inline code block formatting |
AutoFormat |
Auto-convert Markdown syntax while typing |
FormatPainter |
Copy-paste text formatting |
AIAssistant |
AI assistant integration |
Navigation Guide
Getting Started
📄 Read: references/getting-started.md
- Installation, npm setup, CSS imports
- Basic component implementation
- Module injection patterns
- Toolbar configuration basics
- Running the application
Editor Modes
📄 Read: references/editor-modes.md
- HTML editor mode (default WYSIWYG)
- Markdown editor mode with preview
- IFrame vs DIV mode
- Inline editing
- Resizable editor
Toolbar Configuration
📄 Read: references/toolbar-configuration.md
- Default toolbar items
- Toolbar types: Expand, MultiRow, Scrollable
- Toolbar position (top/bottom)
- Sticky/floating toolbar
- Quick toolbar for images and links
Toolbar Tools
📄 Read: references/toolbar-tools.md
- Built-in tools reference (Bold, Italic, Formats, etc.)
- Custom toolbar items with templates
- Text formatting tools
- Styling tools (font, color, alignment)
- Fullscreen tool
Inserting Media
📄 Read: references/insert-media.md
- Inserting images (URL, upload, base64)
- Video insertion and configuration
- Audio insertion
- File browser integration
Inserting Content
📄 Read: references/insert-content.md
- Tables: insert, resize, merge cells
- Hyperlinks: create, edit, open in new tab
- Code blocks
- Custom format blocks
Smart Editing Features
📄 Read: references/smart-editing.md
- Emoji picker
- Slash menu (type
/ to open)
- Mentions (tag users)
- Mail merge
Managing Editor Value
📄 Read: references/editor-value.md
- Setting initial value
- Getting value via property, event, or method
- Two-way binding with React state
- Auto-save with
saveInterval
- Import/export Word and PDF
- Markdown preview
- Character count and maxLength
- Source code view
Paste & Clipboard
📄 Read: references/paste-clipboard.md
- Paste cleanup configuration
- Clipboard cleanup on copy/cut
- Executing editor commands programmatically
Validation & Security
📄 Read: references/validation-security.md
- Form support and submission
- XHTML validation
- Read-only mode
- XSS prevention
AI Assistant
📄 Read: references/ai-assistant.md
- AI integration setup
- AI assistant properties
- Customizing AI toolbar and responses
Accessibility & Globalization
📄 Read: references/accessibility.md
- WCAG 2.1 compliance
- Keyboard shortcuts
- Globalization, localization, RTL
- Style encapsulation
Styling & Customization
📄 Read: references/styling-customization.md
- CSS variable customization
- Style encapsulation (shadow DOM)
- Third-party integrations (CodeMirror, Mention library)
- Spell/grammar check
Undo / Redo
📄 Read: references/undo-redo.md
- Undo/redo manager behavior
- Keyboard shortcuts
- Programmatic undo/redo
Enter Key & Selection
📄 Read: references/enter-key-selection.md
- Enter key configuration (P, BR, DIV)
- Selection API
- Cursor positioning
Events
📄 Read: references/events.md
- Infer EventArgs Type value for each events
- Lifecycle events:
created, destroyed, focus, blur
- Content change:
change event with ChangeEventArgs
- Action events:
actionBegin (cancelable), actionComplete
- Toolbar events:
toolbarClick, updatedToolbarStatus
- Dialog & popup events:
beforeDialogOpen/Close, beforePopupOpen/Close
- Media & file events: image/audio/video upload, select, remove, drop
- Paste & clipboard events:
beforePasteCleanup, afterPasteCleanup
- AI Assistant events:
aiAssistantPromptRequest, aiAssistantToolbarClick
- Resize, slash menu, selection, quick toolbar, import/export events
Methods
📄 Read: references/methods.md
- Focus & content:
focusIn, focusOut, getHtml, getText, getSelectedHtml
- Toolbar:
enableToolbarItem, disableToolbarItem, removeToolbarItem
- Dialog:
showDialog, closeDialog with DialogType enum
- Selection:
selectAll, getRange, selectRange
- Undo/redo:
clearUndoRedo
- AI Assistant:
executeAIPrompt, addAIPromptResponse, getAIPromptHistory, clearAIPromptHistory
- Utility:
executeCommand (all CommandName values), sanitizeHtml, destroy
Properties Reference
📄 Read: references/properties.md
- Core:
height, width, enabled, readonly, placeholder, cssClass
- Toolbar:
toolbarSettings, quickToolbarSettings, floatingToolbarOffset
- Editor mode & behavior:
editorMode, iframeSettings, inlineMode, enterKey
- Value & content:
value, maxLength, showCharCount, saveInterval, enableHtmlSanitizer
- Media:
insertImageSettings, insertVideoSettings, insertAudioSettings, fileManagerSettings
- Font, color & format:
fontFamily, fontSize, fontColor, backgroundColor, format, codeBlockSettings
- Paste:
pasteCleanupSettings, enableClipboardCleanup
- AI Assistant:
aiAssistantSettings (full configuration reference)
- Import/export:
importWord, exportWord, exportPdf
- Misc:
undoRedoSteps, keyConfig, slashMenuSettings, emojiPickerSettings
How-To Guides
📄 Read: references/how-to.md
- Capture Ctrl keys to update value
- Change default font family
- Check uploaded image size
- Customize placeholder style
- Customize shortcut keys
- File attachment
- Format code blocks
- Position cursor at end of content
- Rename images on server
- RTE inside Dialog or Tab
- Set cursor at specific range
- Tailwind preflight fix
- Update value programmatically
Common Patterns
Read value on change
import { ChangeEventArgs } from '@syncfusion/ej2-react-richtexteditor';
function App() {
const ChangeEventArgs) => {
console.log(args.value); // HTML string
};
return (
<RichTextEditorComponent change={onChange}>
<Inject services={[Toolbar, HtmlEditor]} />
</RichTextEditorComponent>
);
}
Controlled value with React state
const [content, setContent] = useState('<p>Hello</p>');
<RichTextEditorComponent value={content} change={(e) => setContent(e.value)}>
<Inject services={[Toolbar, HtmlEditor]} />
</RichTextEditorComponent>
Markdown mode
import { MarkdownEditor } from '@syncfusion/ej2-react-richtexteditor';
<RichTextEditorComponent editorMode="Markdown">
<Inject services={[Toolbar, MarkdownEditor]} />
</RichTextEditorComponent>
1---
2name: syncfusion-react-rich-text-editor
3description: "Implements the Syncfusion React Rich Text Editor (RichTextEditorComponent) from ej2-react-richtexteditor, supporting HTML (WYSIWYG) and Markdown editing. Use this skill for toolbar configuration, image/video/audio insertion, paste cleanup, AI assistant integration, emoji picker, slash menu, mentions, import/export Word/PDF, form validation, and source code view in React applications."
4metadata:
5 author: "Syncfusion Inc"
6 version: "34.1.29"
7 category: "File Viewers & Editors"
8---
9
10# Syncfusion React Rich Text Editor
11
12A WYSIWYG (What You See Is What You Get) editor for creating and formatting rich content as HTML or Markdown. Supports toolbars, media insertion, AI assistance, smart editing features, form validation, and deep customization.
13
14## When to Use This Skill
15
16- Setting up a rich text / WYSIWYG editor in a React app
17- Configuring toolbar items, types, or positions
18- Switching between HTML and Markdown editor modes
19- Inserting images, video, audio, or files
20- Working with smart editing features: emoji, slash menu, mentions, mail merge
21- Integrating AI assistant into the editor
22- Handling editor value: get, set, two-way binding, auto-save, import/export
23- Applying paste cleanup, form validation, or read-only mode
24- Customizing styles, accessibility, or keyboard shortcuts
25
26## Quick Start
27
28```bash
29npm install @syncfusion/ej2-react-richtexteditor
30```
31``` bash
32npm install @syncfusion/ej2-tailwind3-theme
33```
34src/App.css - add CSS imports
35
36```css
37@import '../node_modules/@syncfusion/ej2-tailwind3-theme/styles/rich-text-editor/index.css';
38```
39
40```tsx
41import './App.css';
42import {
43 HtmlEditor, Image, Inject, Link,
44 QuickToolbar, RichTextEditorComponent, Toolbar
45} from '@syncfusion/ej2-react-richtexteditor';
46
47function App() {
48 return (
49 <RichTextEditorComponent height={450}>
50 <Inject services={[Toolbar, Image, Link, HtmlEditor, QuickToolbar]} />
51 </RichTextEditorComponent>
52 );
53}
54export default App;
55```
56
57## Module Injection Reference
58
59Inject only the modules your app needs — this keeps the bundle lean.
60
61| Module | What it enables |
62|---|---|
63| `Toolbar` | Toolbar rendering and commands |
64| `HtmlEditor` | HTML editing mode (default) |
65| `MarkdownEditor` | Markdown editing mode |
66| `Link` | Hyperlink insert/edit/remove |
67| `Image` | Image insertion and management |
68| `Video` | Video insertion |
69| `Audio` | Audio insertion |
70| `Table` | HTML table insert/edit |
71| `QuickToolbar` | Floating toolbar for images/links |
72| `PasteCleanup` | Clean up pasted content formatting |
73| `ClipboardCleanup` | Clean clipboard on copy/cut |
74| `FileManager` | File browser for server-side images |
75| `Resize` | Resizable editor area |
76| `Count` | Character count display |
77| `EmojiPicker` | Emoji search and insert |
78| `SlashMenu` | Slash `/` command menu |
79| `ImportExport` | Import Word, export Word/PDF |
80| `CodeBlock` | Inline code block formatting |
81| `AutoFormat` | Auto-convert Markdown syntax while typing |
82| `FormatPainter` | Copy-paste text formatting |
83| `AIAssistant` | AI assistant integration |
84
85## Navigation Guide
86
87### Getting Started
88📄 **Read:** [references/getting-started.md](references/getting-started.md)
89- Installation, npm setup, CSS imports
90- Basic component implementation
91- Module injection patterns
92- Toolbar configuration basics
93- Running the application
94
95### Editor Modes
96📄 **Read:** [references/editor-modes.md](references/editor-modes.md)
97- HTML editor mode (default WYSIWYG)
98- Markdown editor mode with preview
99- IFrame vs DIV mode
100- Inline editing
101- Resizable editor
102
103### Toolbar Configuration
104📄 **Read:** [references/toolbar-configuration.md](references/toolbar-configuration.md)
105- Default toolbar items
106- Toolbar types: Expand, MultiRow, Scrollable
107- Toolbar position (top/bottom)
108- Sticky/floating toolbar
109- Quick toolbar for images and links
110
111### Toolbar Tools
112📄 **Read:** [references/toolbar-tools.md](references/toolbar-tools.md)
113- Built-in tools reference (Bold, Italic, Formats, etc.)
114- Custom toolbar items with templates
115- Text formatting tools
116- Styling tools (font, color, alignment)
117- Fullscreen tool
118
119### Inserting Media
120📄 **Read:** [references/insert-media.md](references/insert-media.md)
121- Inserting images (URL, upload, base64)
122- Video insertion and configuration
123- Audio insertion
124- File browser integration
125
126### Inserting Content
127📄 **Read:** [references/insert-content.md](references/insert-content.md)
128- Tables: insert, resize, merge cells
129- Hyperlinks: create, edit, open in new tab
130- Code blocks
131- Custom format blocks
132
133### Smart Editing Features
134📄 **Read:** [references/smart-editing.md](references/smart-editing.md)
135- Emoji picker
136- Slash menu (type `/` to open)
137- Mentions (tag users)
138- Mail merge
139
140### Managing Editor Value
141📄 **Read:** [references/editor-value.md](references/editor-value.md)
142- Setting initial value
143- Getting value via property, event, or method
144- Two-way binding with React state
145- Auto-save with `saveInterval`
146- Import/export Word and PDF
147- Markdown preview
148- Character count and maxLength
149- Source code view
150
151### Paste & Clipboard
152📄 **Read:** [references/paste-clipboard.md](references/paste-clipboard.md)
153- Paste cleanup configuration
154- Clipboard cleanup on copy/cut
155- Executing editor commands programmatically
156
157### Validation & Security
158📄 **Read:** [references/validation-security.md](references/validation-security.md)
159- Form support and submission
160- XHTML validation
161- Read-only mode
162- XSS prevention
163
164### AI Assistant
165📄 **Read:** [references/ai-assistant.md](references/ai-assistant.md)
166- AI integration setup
167- AI assistant properties
168- Customizing AI toolbar and responses
169
170### Accessibility & Globalization
171📄 **Read:** [references/accessibility.md](references/accessibility.md)
172- WCAG 2.1 compliance
173- Keyboard shortcuts
174- Globalization, localization, RTL
175- Style encapsulation
176
177### Styling & Customization
178📄 **Read:** [references/styling-customization.md](references/styling-customization.md)
179- CSS variable customization
180- Style encapsulation (shadow DOM)
181- Third-party integrations (CodeMirror, Mention library)
182- Spell/grammar check
183
184### Undo / Redo
185📄 **Read:** [references/undo-redo.md](references/undo-redo.md)
186- Undo/redo manager behavior
187- Keyboard shortcuts
188- Programmatic undo/redo
189
190### Enter Key & Selection
191📄 **Read:** [references/enter-key-selection.md](references/enter-key-selection.md)
192- Enter key configuration (P, BR, DIV)
193- Selection API
194- Cursor positioning
195
196### Events
197📄 **Read:** [references/events.md](references/events.md)
198- Infer EventArgs Type value for each events
199- Lifecycle events: `created`, `destroyed`, `focus`, `blur`
200- Content change: `change` event with `ChangeEventArgs`
201- Action events: `actionBegin` (cancelable), `actionComplete`
202- Toolbar events: `toolbarClick`, `updatedToolbarStatus`
203- Dialog & popup events: `beforeDialogOpen/Close`, `beforePopupOpen/Close`
204- Media & file events: image/audio/video upload, select, remove, drop
205- Paste & clipboard events: `beforePasteCleanup`, `afterPasteCleanup`
206- AI Assistant events: `aiAssistantPromptRequest`, `aiAssistantToolbarClick`
207- Resize, slash menu, selection, quick toolbar, import/export events
208
209### Methods
210📄 **Read:** [references/methods.md](references/methods.md)
211- Focus & content: `focusIn`, `focusOut`, `getHtml`, `getText`, `getSelectedHtml`
212- Toolbar: `enableToolbarItem`, `disableToolbarItem`, `removeToolbarItem`
213- Dialog: `showDialog`, `closeDialog` with `DialogType` enum
214- Selection: `selectAll`, `getRange`, `selectRange`
215- Undo/redo: `clearUndoRedo`
216- AI Assistant: `executeAIPrompt`, `addAIPromptResponse`, `getAIPromptHistory`, `clearAIPromptHistory`
217- Utility: `executeCommand` (all `CommandName` values), `sanitizeHtml`, `destroy`
218
219### Properties Reference
220📄 **Read:** [references/properties.md](references/properties.md)
221- Core: `height`, `width`, `enabled`, `readonly`, `placeholder`, `cssClass`
222- Toolbar: `toolbarSettings`, `quickToolbarSettings`, `floatingToolbarOffset`
223- Editor mode & behavior: `editorMode`, `iframeSettings`, `inlineMode`, `enterKey`
224- Value & content: `value`, `maxLength`, `showCharCount`, `saveInterval`, `enableHtmlSanitizer`
225- Media: `insertImageSettings`, `insertVideoSettings`, `insertAudioSettings`, `fileManagerSettings`
226- Font, color & format: `fontFamily`, `fontSize`, `fontColor`, `backgroundColor`, `format`, `codeBlockSettings`
227- Paste: `pasteCleanupSettings`, `enableClipboardCleanup`
228- AI Assistant: `aiAssistantSettings` (full configuration reference)
229- Import/export: `importWord`, `exportWord`, `exportPdf`
230- Misc: `undoRedoSteps`, `keyConfig`, `slashMenuSettings`, `emojiPickerSettings`
231
232### How-To Guides
233📄 **Read:** [references/how-to.md](references/how-to.md)
234- Capture Ctrl keys to update value
235- Change default font family
236- Check uploaded image size
237- Customize placeholder style
238- Customize shortcut keys
239- File attachment
240- Format code blocks
241- Position cursor at end of content
242- Rename images on server
243- RTE inside Dialog or Tab
244- Set cursor at specific range
245- Tailwind preflight fix
246- Update value programmatically
247
248## Common Patterns
249
250### Read value on change
251```tsx
252import { ChangeEventArgs } from '@syncfusion/ej2-react-richtexteditor';
253
254function App() {
255 const onChange = (args: ChangeEventArgs) => {
256 console.log(args.value); // HTML string
257 };
258 return (
259 <RichTextEditorComponent change={onChange}>
260 <Inject services={[Toolbar, HtmlEditor]} />
261 </RichTextEditorComponent>
262 );
263}
264```
265
266### Controlled value with React state
267```tsx
268const [content, setContent] = useState('<p>Hello</p>');
269<RichTextEditorComponent value={content} change={(e) => setContent(e.value)}>
270 <Inject services={[Toolbar, HtmlEditor]} />
271</RichTextEditorComponent>
272```
273
274### Markdown mode
275```tsx
276import { MarkdownEditor } from '@syncfusion/ej2-react-richtexteditor';
277<RichTextEditorComponent editorMode="Markdown">
278 <Inject services={[Toolbar, MarkdownEditor]} />
279</RichTextEditorComponent>
280```