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